Well, it could point to a different application, if you make the
mistake of calling getApplicationContext() rather than
getApplication().

It might usually be the right one, but then one day in another
circumstance be the wrong one.

The only thing you can say is it will be in the same process.

So make sure to use getApplication() instead!

On Mar 17, 12:45 pm, Mark Murphy <mmur...@commonsware.com> wrote:
> Matt (preinvent) wrote:
> >> The underlying getSharedPreferences() method takes a string, which is the
> >> unique set of preferences for that package.  Any context in that 
> >> application
> >> using that same string will be working with the same preferences (hence why
> >> they are shared).
>
> > The context I'm being passed may come from a service, widget update
> > request, activity or broadcast receiver (from the BATTERY_CHANGE
> > action).  Can I be sure that the context points to my application in
> > all those instances?
>
> What else would it point to?
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> Android App Developer Books:http://commonsware.com/books

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