Matroska
Matroska

Reputation: 6923

DialogFragment in PreferenceActivity

I have defined dialogfragments (because Android documentation says that it is better and indeed it is) but now I want to use it in PreferenceActivity.

The problem is that I cannot use getSupportFragmentManager() there and I cannot use PreferenceFragment since it doesn't work with compatibility library. Looks like a road block scenario.

Can anyone advise on this?

Upvotes: 17

Views: 3522

Answers (1)

almalkawi
almalkawi

Reputation: 1118

As you noted, PreferenceFragment is not in the android compatibility package and unfortunately there is no clean way around this. For my own personal project, I had to adapt an implementation off of Android's source code: http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/4.0.4_r1.2/android/preference/PreferenceFragment.java

The answers to this question have some great suggestions: Was PreferenceFragment intentionally excluded from the compatibility package?

Upvotes: 1

Related Questions