Shared Preferences

Shared Preferences

1、SharedPreferences  class.

  Interface for accessing and modifying preference data returned by getSharedPreferences(String, int)

参考:http://android.xsoftlab.net/reference/android/content/SharedPreferences.html

2、getSharedPreferences(String, int mode)

  Retrieve and hold the contents of the preferences file 'name', returning a SharedPreferences through which you can retrieve and modify its values.

  Only one instance of the SharedPreferences object is returned to any callers for the same name, meaning they will see each other's edits as soon as they are made.

  Moe:Operating mode. Use 0 or MODE_PRIVATE for the default operation, MODE_WORLD_READABLE and MODE_WORLD_WRITEABLE to control permissions.

  MODE_WORLD_READABLE、MODE_WORLD_WRITEABLE is deprecated.

参考:http://android.xsoftlab.net/reference/android/content/Context.html#getSharedPreferences(java.lang.String, int)

3、Using Shared Preferences

  The SharedPreferences class provides a general framework that allows you to save and retrieve persistent key-value pairs of primitive data types. You can use SharedPreferences to save any primitive data: booleans, floats, ints, longs, and strings. This data will persist across user sessions (even if your application is killed).

参考:http://android.xsoftlab.net/guide/topics/data/data-storage.html#pref

上一篇:php-fpm慢日志配置


下一篇:XHTML 结构化:使用 XHTML 重构网站 分类: C1_HTML/JS/JQUERY 2014-07-31 15:58 249人阅读 评论(0) 收藏