I have preference defined in xml, and I do this addPreferencesFromResource(R.xml.preferences1); to create the pref activity. But in code (dynamically) at runtime somethimes(depends on busyness logic) I add more items like this
CheckBoxPreference c=new CheckBoxPreference(this);
c.setKey("asdasd");
c.setTitle("asd");
getPreferenceScreen().addPreference(c);
This works great and everything is fine(the state is sa开发者_开发技巧ved corectlly and it stays persistent) until I restart the phone. When I restart the phone this newly added item is lost. And only items from the xml file are shown in the prefereceActivity.
My question is what should I do to have this items even when the user restart the phone.
精彩评论