Android Getting Started: sharedpreferences

Source: Internet
Author: User

Read data:

Save data:

+++++++++++++++++++ Method Detailed ++++++++++++++++++++++++++++++

Sharedpreferences Overview:

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

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

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

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

Summary:

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

Android Getting Started: sharedpreferences

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.