码迷,mamicode.com
首页 > 移动开发 > 详细

app Token config

时间:2017-08-15 00:55:28      阅读:297      评论:0      收藏:0      [点我收藏+]

标签:reference   har   cache   share   context   span   color   nbsp   turn   

public class Config {
    private static final String TOKEN_KEY = "token";
    private static final String APP_ID = "com.jiangcun.secret";
    public static String getCacheToken(Context context){
        return context.getSharedPreferences(APP_ID , Context.MODE_PRIVATE).getString(TOKEN_KEY,null);
    }

    public static void cacheToken(Context context,String token){
        SharedPreferences.Editor editor = context.getSharedPreferences(APP_ID,Context.MODE_APPEND).edit();
        editor.putString(TOKEN_KEY,token);
        editor.commit();
    }
}

 

public class Config {
private static final String TOKEN_KEY = "token";
private static final String APP_ID = "com.jiangcun.secret";
public static String getCacheToken(Context context){
return context.getSharedPreferences(APP_ID , Context.MODE_PRIVATE).getString(TOKEN_KEY,null);
}

public static void cacheToken(Context context,String token){
SharedPreferences.Editor editor = context.getSharedPreferences(APP_ID,Context.MODE_APPEND).edit();
editor.putString(TOKEN_KEY,token);
editor.commit();
}
}

app Token config

标签:reference   har   cache   share   context   span   color   nbsp   turn   

原文地址:http://www.cnblogs.com/halo-yang/p/7362190.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!