android入門之: SharedPreferences,android女

來源:互聯網
上載者:User

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.

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.