Skip to content Skip to sidebar Skip to footer

Getsupportfragmentmanager() Versus Getfragmentmanager() In Android 3.0+

In the documentation for android.support.v4.app.FragmentManager: 'Static library support version of the framework's FragmentManager. Used to write apps that run on platforms prior

Solution 1:

There's nothing wrong with using getSupportFragmentManager() on Android 3.0+ as long as you have the support library imported. If you want to use getFragmentManager() for SDKs 11+, go for it; just keep in mind that you may be if/elseing a lot of code with version checks.

Solution 2:

If you are using API >= 14, then use getFragmentManager(). If you want compatibility with devices below API 14 then you can use getSupportFragmentManager(). Therefore, getSupportFragmentManager() is used to deliver newer features to older platforms.

Solution 3:

If you are using support Packages in your project or app, then you have to use getSupportFragmentManager because that is how you will return the fragmentManager for interacting with fragments associated with this activity. In the other hand, if you are not, then you can use getFragmentManager. It only depends on what you are using in your app.

Post a Comment for "Getsupportfragmentmanager() Versus Getfragmentmanager() In Android 3.0+"