Turns out that there is no API method for solving my problem, below is
a 4-line solution.
public static String getSharedPreferenceName(Context ctx, int
prefResId){
String packageName =
ctx.getApplicationContext().getPackageName();
Resources res = ctx.getResources();
String entryName = res.getResourceEntryName(prefResId);
return packageName+"_"+entryName;
}
On Wed, Oct 20, 2010 at 2:32 AM, Agus <[email protected]> wrote:
> Within the PreferenceActivity class, I can obtain the sharedpreference
> name by calling:
> getPreferenceManager().getSharedPreferencesName();
>
> How to get the SharedPreferences name managed by PreferenceActivity
> outside of the PreferenceActivity class?
>
--
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