views:

37

answers:

0

I am trying to allow users to dynamically create a PreferenceScreen structure at runtime (i.e. users may add/remove certain PreferenceScreen elements such as list items). I then want the PreferenceActivity to not only preserve individual settings but also the preference structure created by the user, even if the app is re-launched. Is there an efficient way to do this?

Seems to be more complicated than I thought. Obviously the settings themselves (for example a checkbox toggle state) are stored when I add a preference to the PreferenceScreen dynamically, i.e. when I add the preference (with same key) again later it has the choosen state. But it seems that I need to know which kind of preference to add to the PreferenceScreen myself (presumably this information is not stored in the SharedPreferences, correct?). Would it be a good approach to save the PreferenceScreen structure created by the user to a xml file by hand in order to read it as a normal xml resource file later?