程序间保存数据SharedPreferences

SharedPreferences sp = getSharedPreferences("config", MODE_PRIVATE);
String cacheToken = sp.getString("loginToken", "");

if (!TextUtils.isEmpty(cacheToken)){
//为空


SharedPreferences sp = getSharedPreferences("config", MODE_PRIVATE);
SharedPreferences.Editor editor=sp.edit();
editor.putString("language",language);
editor.apply();

posted on 2017-03-27 14:52  yaolunhui  阅读(116)  评论(0编辑  收藏  举报

导航