Reputation: 16781
I have a PreferenceFragment
and I need to put custom preferences in it. Now the problems are not the custom preferences themselves, I already extended some DialogPreference
s creating my own preferences and I already dealt with saving/restoring data; the problem is how do I add these custom preferences to my PreferenceFragment
? I can't declare them in XML (can I?), and I can't find any method to dynamically add them to my PreferenceFragment
.
Upvotes: 0
Views: 187
Reputation: 36449
Haven't tried it myself, but for an xml based approach, maybe you can do this:
<com.mypackage.MyPreference
android:defaultValue="value"
android:key="key"
android:title="Title"/>
Then use addPreferencesFromResource()
as usual.
Upvotes: 2