Next, we need to write our preferences class:
01 | /** stores the user object in SharedPreferences */ |
02 | public class UserPrefs{ |
04 | /** This application's preferences label */ |
05 | private static final String PREFS_NAME = "com.our.package.UserPrefs" ; |
07 | /** This application's preferences */ |
08 | private static SharedPreferences settings; |
10 | /** This application's settings editor*/ |
11 | private static SharedPreferences.Editor editor; |
13 | /** Constructor takes an android.content.Context argument*/ |
14 | public UserPrefs(Context ctx){ |
16 | settings = ctx.getSharedPreferences(PREFS_NAME, |
17 | Context.MODE_PRIVATE ); |
24 | editor = settings.edit(); |
No comments:
Post a Comment