android入門之: SharedPreferences,android女
讀取資料:
儲存資料:
+++++++++++++++++++方法詳解++++++++++++++++++++++++++++++
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.