0

from some of the answer such as
Using getFragmentManager() vs getSupportFragmentManager()?
I find that getFragmentManager() is used for API>=14,
and getSupportFragmentManager() will be used in support lib such as v4 which also support older API.

So my question is should I just use getSupportFragmentManager (import the support.v4 for each classes) so that my application can be used in any API version?
And are there any different I should know between these 2 FragmentManager?

Community
  • 1
  • 1
brian661
  • 538
  • 3
  • 11
  • 31
  • hi, usally i use supportfragments you never know when a client decide that his application should also run on older androids :p, here is another [discussion](http://stackoverflow.com/questions/17295497/fragment-or-support-fragment) about this topic – medhdj Feb 09 '15 at 17:35
  • answer to the first question is, unfortunately, another question: What is your minSDK? – Blackbelt Feb 09 '15 at 17:38

2 Answers2

0

If you are interested in supporting API versions that do not have Fragments, then by all means use the FragmentActivity and getSupportFragmentManager() patterns.

Even if you are not targeting an API below 14, it may be a good idea to use the support library. Classes in the support library can be updated by you, the developer, whenever Google releases a bugfix/feature in the library that you are interested in. If you use a framework class, you only get the updates when your users get a firmware update, which we all know can take a while. Using the support library means all users are using the same "latest-and-greatest" classes.

emerssso
  • 2,376
  • 18
  • 24
0

Yes, for Fragment, just use getSupportFragmentManager, then your app for Fragment can be compatible backward to old API levels, normally minSDKversion = 7 is enough. However if you really want your app to get compitability with most API levels, then there still many other components your app concerning need use support library, such as ActionBar, etc..

For more info, please go through Android Docs: Support Library Features

Xcihnegn
  • 11,579
  • 10
  • 33
  • 33