首页 > 移动平台 > 详细

android入门之: SharedPreferences

时间:2015-09-04 12:20:02      阅读:221      评论:0      收藏:0      [点我收藏+]

读取数据:

 

技术分享

 

保存数据:

 

技术分享

 

+++++++++++++++++++方法详解++++++++++++++++++++++++++++++

SharedPreferences综述:

使用getSharedPreferences(String, int) 方法提供获取和修改preference的接口

对于任意指定的preferences集合, 所有的app共享同一个实例;

如果想要 修改preferces的话, 必须通过SharedPreferences.Editor 对象; 该对象可以保证preference状态一致而且可以控制存储;他的各种get方法的返回对象必须在整个程序中是不可变的;

使用方法http://wear.techbrood.com/guide/topics/data/data-storage.html#pref

 

摘要:

Interface for accessing and modifying preference data returned by getSharedPreferences(String, int). For any particular set of preferences, there is a single instance of this class that all clients share. Modifications to the preferences must go through an SharedPreferences.Editor object to ensure the preference values remain in a consistent state and control when they are committed to storage. Objects that are returned from the various getmethods must be treated as immutable by the application.

android入门之: SharedPreferences

原文:http://www.cnblogs.com/greentomlee/p/4781461.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!