Android data Access

Source: Internet
Author: User

  1. Android provides preference (config), file (files), SQLite data and several data access methods of the network

  2. Sharedpreference provides a lightweight approach to data access, where the application is mostly less configuration information, which stores the data in a key-value pair in an XML configuration file with an XML file path of/data/data/< Package Name>/shared_prefs directory. It is itself an interface and does not provide the ability to write data , but instead, the edit () method is called by the Sharedpreferences internal interface to return the editor object it corresponds to. The Sharedpreferences instance cannot be created directly in the program, only the Sharedpreferences instance can be obtained through the Getsharedpreferences method provided by the context .

  3. Read and write sharedpreferences for other applications:
      • Get the corresponding context for other applications, using the Createpackagecontext function
      • Call Context.getsharedpreferences to get the Sharedpreferences object for the response
      • To write data using the Edit object

Android data Access

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.