Use [this.] getSharedPreferences(String name, int mode) from any of your
components, provided that you use the same "name" parameter.
http://developer.android.com/reference/android/content/Context.html#getSharedPreferences(java.lang.String,
int)
Retrieve and hold the contents of the preferences file 'name',
returning a SharedPreferences through which you can retrieve and
modify its values. *Only one instance of the SharedPreferences object
is returned to any callers for the same name, meaning they will see
each other's edits as soon as they are made.*
Activity.getPreferences (int mode) just calls the above method with the
activity's class name, making those prefs private to that particular
activity class.
-- Kostya
01.03.2011 19:17, dashman ?????:
What are the differences between any of these calls -
all called from within my Activity sub-class instance.
getApplicationContext()
getBaseContext()
this
I need to get the context primarily for prefs for my apps - there
are multiple Activities but i'd like to reference the same
common prefs for my app.
--
Kostya Vasilyev -- http://kmansoft.wordpress.com
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en