缥帙各舒散,前后互相逾。这篇文章主要讲述app Token config相关的知识,希望能为你提供帮助。
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】
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();
}
}
推荐阅读
- Android 音视频开发入门指南
- Android Studio开发地图问题
- Android中RecyclerView嵌套RecyclerView或嵌套ListView
- Appium 1.6安装步骤
- Android WebView中软键盘会遮挡输入框相关问题
- Android ClassLoader
- Mac appium apk覆盖性安装的问题
- 客户端与服务端,java与Android跨平台服务
- Android sdk 更新后编译不过,Could not find com.android.sdklib.build.ApkBuilderMain