Since now you want to support Gingerbread and lower, you have to use the android.support.v4.app.*
Fragment classes for your app to compile and run.
The call to getFragmentManager()
should also be replaced with getSupportFragmentManager()
It is also important to note that calling getSupportFragmentManager()
is only part of FragmentActivity
and ActionBarActivity
(the latter is an extention of the former. It is a part of Google's ActionBarCompat library).
This is because since the support Fragments are an addition to the Android system, there needs to be a way to implement them without relying too much on the Android internals (since Gingerbread and lower have no notion of a Fragment
).
but it's weird because if i use it on one inner class (i have the DialogFragments) it takes the error away on both. Why is that?
It's likely you are encountering multiple Android Lint errors
What would that do in case i run my app on a higher API
Nothing, the support library works with new API versions as well. Of course, if you had previous code that required API 11+, then you need to figure out a way to backport that as well.
Would the app use the compatability library or would it know to use the class from that API?
The support Fragment
documentation says:
When running on Android 3.0 or above, this implementation is still used; it does not try to switch to the framework's implementation.
Support Fragments will always be used. Usually, this isn't an issue.