>>>>> "MM" == Mark Murphy <mmur...@commonsware.com> writes:

   MM> On Fri, Jan 18, 2013 at 8:58 AM, Jake Colman <col...@ppllc.com> wrote:

   >> If that is not guaranteed then should I not be using context-based
   >> preferences to persist my data?

   MM> I have no idea what you consider "context-based preferences" to
   MM> be. If you mean static data members, they should be used as a
   MM> cache for persistent data or for transient purposes only.

   >> Is there something other than
   >> PreferenceManager.getDefaultSharedPreference to do this?

   MM> SharedPreferences are persistent, assuming that you use commit() or 
apply().


Please correct me if/when I use incorrect terms.

I am using getDefaultSharedPreferences to access my preference keys from
my Preference Screens and to get/set certain keys state data.  I am
committing these preferences as per standard practice.  

The call to getDefaultSharedPreferences takes a context.  Depending on
where I am making the call, the context that I am passing is either:

1) A 'this' pointer from a Preference Activity
2) A 'this' pointer from a Service
3) The 'context' parameter passed into the onReceive method of my
   AppWidgetProvider subclass.

Am I making a fundamental mistake in how this is supposed to be done?
You've already told me that when the application is recreated it gets a
new context.  If so, how are preferences persisted across recreations of
my application if the "key" to those preferences are the context?

-- 
Jake Colman -- Android Tinkerer

-- 
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