I started to change my App to Material design.
I´ve changed my Activity to ActionBarActivity
and My Theme to AppCompat, to be able to color ActionBar and use AppCompat Navigation drawer.
I´m switching Fragments in my Activity, which are added to backstack throught
getSupportFragmentManager()
.beginTransaction()
.replace(...)
.addToBackStack(null)
.commit();
I have to use SupportFragmentManager because of AppCompat. Therefore, I have to use android.support.v4.app.Fragment
from support library.
Problem:
I´m also using PreferenceFragment
, which is not included in support library. And therefore, I can´t add the fragment to backstack.
Error: The method replace(int, Fragment, String) in the Type FragmentTransaction is not applicable for the Arguments (int, SettingsFragment, String)
The solution I'm using right now is this library. I don't want to use it, because I'm targeting API 14.
Is there a way I can use PreferenceFragment with SupportFragmentManager?
No, support FragmentManager
accepts only support Fragment
s and there is no way you can use fragments from android.app
package.
BTW, I suggest you to use this library instead. It has minSdkVersion
of 7, but it has recent updates and I think it's more stable than the library you're currently using.