Yes it is actually better to use static classes for your constants.
e.g.

class C {
        public static final String PREFS_NAME = "MyPrefsFile";
        public static final String PREFS_FAVS = "MyFavs";
        public static final String PREFS_RECENT = "MyRecents";
}

so can use it from any other activity as follows:

SharedPreferences settings = this.getSharedPreferences(C.PREFS_NAME,
0);
String recent = settings.getString(C.PREFS_RECENT, defaultValue);


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" 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-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to