I was working on fragments and came across two things Activity
and FragmentActivity
which are used several times. I want to know that is there any difference between these two, because when I changed Activity
with FragmentActivity
, it had no effect on the app.
This question is related to
android
android-fragments
android-support-library
android-fragmentactivity
FragmentActivity
is part of the support library, while Activity
is the framework's default class. They are functionally equivalent.
You should always use FragmentActivity
and android.support.v4.app.Fragment
instead of the platform default Activity
and android.app.Fragment
classes. Using the platform defaults mean that you are relying on whatever implementation of fragments is used in the device you are running on. These are often multiple years old, and contain bugs that have since been fixed in the support library.
Source: Stackoverflow.com