SharedPrefences的用处
2024-10-11 23:47:42
存储数据
SharedPreferences.Editor edit = getSharedPreferences("data", MODE_PRIVATE).edit();
edit.putString("bookname", "完美");
edit.putString("anthor", "刘红");
edit.putInt("page", 700);
edit.putInt("price", 230);
edit.apply();
读取数据
SharedPreferences prep = getSharedPreferences("data", MODE_PRIVATE);
String bookname= prep.getString("bookname", "");
String anthor= prep.getString("anthor", "");
int page= prep.getInt("page",0);
int price=prep.getInt("price",0);
最新文章
- 【记录】ASP.NET IIS ISAPI_Rewrite
- windows下vim编辑器,字符编码设置。
- flume 使用 spool source的时候字符集出错
- 12.C#yield return和yield break及实际应用小例(六章6.2-6.4)
- C++重要知识点小结---2
- Core身份认证
- Objective-C Autorelease Pool 的实现原理
- SuperSocket使用demo
- Java之GUI编程(一)
- 《JavaScript高级程序设计》读书笔记 ---操作符一
- Myeclipse黑色主题配置
- 剖析非同质化代币ERC721-全面解析ERC721标准
- python 玩耍天地
- QT使用MSVC编译器输出中文乱码问题解决方法
- vue教程自学笔记(二)
- Python开发——函数【基础】
- 《剑指offer》-中序遍历下一个节点
- 字典树Trie树
- ACM题目————Face The Right Way
- phpdocumentor生成代码注释文档(linux)
热门文章
- Fix ";Unable to lock the administration directory (/var/lib/dpkg/)"; in Ubuntu
- Apsara Clouder专项技能认证:实现调用API接口 (笔记)
- hadoop第一个例子WordCount
- Node.js 101(2): Promise and async
- 替换Android自带apk【转】
- 强大的DataGrid组件[7]_自定义DataGrid——Silverlight学习笔记[15]
- iOS 7 present/dismiss转场动画
- python的thread和threading区别
- Spring事物注意事项
- Gym 100548F Color (数论容斥原理+组合数)