Search code examples
androidandroid-fragmentsandroid-support-libraryandroid-fragmentactivity

Difference between Activity and FragmentActivity


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.


Solution

  • A FragmentActivity is a subclass of Activity that was built for the Android Support Package.

    The FragmentActivity class adds a couple new methods to ensure compatibility with older versions of Android, but other than that, there really isn't much of a difference between the two. Just make sure you change all calls to getLoaderManager() and getFragmentManager() to getSupportLoaderManager() and getSupportFragmentManager() respectively.