Use getSupportFragmentManager () Inside PreferenceActivity

I have a custom one that extends PreferenceActivity (from ). The layout for this action contains . Inside this layout, I need to programmatically add / replace a couple of other fragments that I created that expand . ConfigActivityandroid.preference.PreferenceActivity<ListView android:id="@android:id/list"...android.support.v4.app.Fragment

However, Eclipse says:

The method getSupportFragmentManager() is undefined for the type ConfigActivity.

I tried replacing it only with getFragmentManager(), but the following call:

ft.add(R.id.fHeader, new MyCustomFragment());

leads to the following error:

The method add(int, Fragment) in the type FragmentTransaction is not applicable for the arguments (int, MyCustomFragment)

Am I the only option to NOT use my custom fragments that extend the Fragment library class inside ConfigActivity?

+4
source share
2

, FragmentActivity FragmentActivity , android.support.v4.app.Fragment. sdk 12 .

+2

Activity FragmentManager. Fragment Activity, FragmentActivity, .
Android , PreferenceActivity MyPreferenceActivity extends FragmentActivity. , :)

0

All Articles