Tekkaman

导航

 

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

 

posted on 2017-03-08 16:49  Tekkaman  阅读(173)  评论(0编辑  收藏  举报