转载: http://blog.csdn.net/xzlawin/article/details/45959033

方法1:

存数据:

SharedPreferences userInfo = this.getSharedPreferences("user_info", 0);
userInfo.edit().putString("name", nameet.getText().toString()).commit();
userInfo.edit().putString("password", passwordet.getText().toString()).commit();

读数据

SharedPreferences userInfo = this.getSharedPreferences("user_info", 0);
nameet.setText(userInfo.getString("name", ""));
passwordet.setText(userInfo.getString("password", ""));

方法2:

存数据:

SharedPreferences setting = getSharedPreferences("setting", 0);
SharedPreferences.Editor editor = setting.edit();
editor.putString("apiUrl", "hello").commit();

读数据

SharedPreferences setting =  getSharedPreferences("setting", 0);
String apiUrl=setting.getString("apiUrl","");

最新文章

  1. DIV的Position属性和DIV嵌套DIV
  2. Python之路-python(mysql介绍和安装、pymysql、ORM sqlachemy)
  3. LoadRunner之篇
  4. eclipse提示:This tag and its children can be replaced by one <TextView/> and a compound drawable
  5. SQL复杂查询和视图
  6. ML 04、模型评估与模型选择
  7. 编译内核,配置内核make menuconfig
  8. (转)rabbitMQ基础知识及命令语句
  9. .Net Core 部署到IIS
  10. 串口接收端verilog代码分析
  11. Python 成仙之路
  12. BR(BoomerangRobot)机器人项目
  13. 7.Solr查询参数
  14. AS3 注意点
  15. hdoj1180 诡异的楼梯(bfs+奇偶判断)
  16. 【BZOJ4872】【Shoi2017】分手是祝愿
  17. 使用postman做接口测试(一)
  18. Ubuntu下的apache2的配置过程
  19. python 数据分析----matplotlib
  20. BZOJ2152 聪聪可可 【点分治】

热门文章

  1. lambda函数
  2. Linux 下RPM打包制作流程
  3. 简单的将Excel数据同步到SqlServer数据库中
  4. Educational Codeforces Round 52 (Rated for Div. 2) -C
  5. stl stack用法
  6. 软件扒网站? 爬虫? F12查看源码? 查看网页源代码?浏览器sources? 区别和联系!
  7. vue echarts 动态数据
  8. python知识点及面试面试大集合
  9. Python之字符串操作
  10. 【学习总结】win7下安装Ubuntu双系统的日常