SharePreferences使用
2015-09-30 11:41
260 查看
获取数据:
插入数据:
@SuppressLint("InlinedApi") private String getFromSharePreference(String key) { if (TextUtils.isEmpty(key)) { return null; } if (mShare == null) { if (VERSION.SDK_INT >= 11) { mShare = this.getSharedPreferences( SHAREPREFERENCES_SCAN_COURSE, Context.MODE_MULTI_PROCESS); } else { mShare = this.getSharedPreferences( SHAREPREFERENCES_SCAN_COURSE, Context.MODE_PRIVATE); } } return mShare.getString(key, null); }
插入数据:
@SuppressLint("InlinedApi") private String getFromSharePreference(String key) { if (TextUtils.isEmpty(key)) { return null; } if (mShare == null) { if (VERSION.SDK_INT >= 11) { mShare = this.getSharedPreferences( SHAREPREFERENCES_SCAN_COURSE, Context.MODE_MULTI_PROCESS); } else { mShare = this.getSharedPreferences( SHAREPREFERENCES_SCAN_COURSE, Context.MODE_PRIVATE); } } return mShare.getString(key, null); }
相关文章推荐
- js判断数组,对象是否存在某一未知元素
- Javascript和OCX的结合历程
- Caffe框架,了解三个文件
- Caffe框架,了解三个文件
- web-js入门
- eval、json.parse()的介绍和使用注意点
- jstl fmt:formatNumber 数字货币格式化
- ReactiveCocoa 和 MVVM 入门
- jsp语法 指令 内置对象
- 前端自动化开发之grunt
- JavaScript(一)
- 通过前端获取客户端ip和所在城市,并在后端获得这些值
- JSP学习笔记之基础语法
- JSON.parse()和eval()的区别
- js 一个等号"=" 二个等号"==" 三个等号"===" 的区别
- OutputStreamWriter和BufferedWriter疑惑
- jquery 实现 div 拖动效果
- CSS立体标签实现
- css圆形图片处理示例(方形图片变圆形图片)
- 浅谈HTML5的Camera API