Hi,

I'm finding if I save pref's and then turn my G1 off and back on, they
have been erased. Is that the expected behaviour? I've seen similar
reports from a search, but cannot find a solution.

My code to save and restore is as follows:-

public void save() {
SharedPreferences activityPreferences = myActivity.getPreferences
(Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = activityPreferences.edit();
editor.putString("PrefName", "My String");
editor.commit();
}


public String load() {
SharedPreferences activityPreferences = myActivity.getPreferences
(Activity.MODE_PRIVATE);
return activityPreferences.getString("PrefName", "Default String");
}

Thanks a lot for any advice.

Ryan
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to