Step 7, step 4, getting started with Piglet Android

Source: Internet
Author: User

Step 7, step 4, getting started with Piglet Android

Step 7, step 4, getting started with Piglet Android

Data storage and access for Android-ContentProvider)

--- Reprinted with the source: coder-pig


This section introduces:

In the previous study, we have learned some ways to store data, which can be shared. For example, for files, we can perform operations

The mode is set to Context. MODE_WORLD_READABLE or Context. MODE_WORLD_WRITEABLE. Other applications

You can access the file for read and write operations. SharedPreference can also be used for sharing, and permissions can also be set! And use

The benefit of ContentProvider's data sharing is that the same data access method! This is the only way to share data between different applications, because

For a storage region that does not provide the access of all applications in Android! Well, it's actually not that mysterious. Please follow the author's instructions below.

To parse the ContentProvider of Android!



This section describes the road map:




Body:


ContentProvider overview and execution principles




Custom ContentProvider



Reference code:

Code Effect: Insert a record into the database of the first program through the second program

Download reference code:Code download



Use the ContentProvider provided by the system




Code example: Call the SMS and contacts provided by the system

Download reference code:Code download



Listen for ContentProvider data changes

Download:Code download



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.