Re: [android-developers] Re: How to get the SharedPreferences name managed by PreferenceActivity outside of the PreferenceActivity class?

2010-10-20 Thread Agus
You are right, should be this: String packageName = ctx.getPackageName(); On Wed, Oct 20, 2010 at 8:40 AM, TreKing wrote: > On Wed, Oct 20, 2010 at 4:46 AM, Agus wrote: >> >> ctx.getApplicationContext() > > This is completely redundant. > > Also, why do you need the "name" anyway? > >

Re: [android-developers] Re: How to get the SharedPreferences name managed by PreferenceActivity outside of the PreferenceActivity class?

2010-10-20 Thread TreKing
On Wed, Oct 20, 2010 at 4:46 AM, Agus wrote: > ctx.getApplicationContext() This is completely redundant. Also, why do you need the "name" anyway? - TreKing

[android-developers] Re: How to get the SharedPreferences name managed by PreferenceActivity outside of the PreferenceActivity class?

2010-10-20 Thread Agus
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.getRe