Piglet's Android starter Road Day 7 Part 4

Source: Internet
Author: User

Piglet's Android starter Road Day 7 Part 4

--contentprovider (content Provider) for Android data storage and access

---Reprint please specify the Source: Coder-pig


Introduction to this section:

In the previous study, we have learned some ways to store data, and these can be shared, such as files, we can put the operation

Mode is set to Context.mode_world_readable or context.mode_world_writeable, other applications

can access the file for read and write operations, and the use of sharedpreference can be shared, but also set permissions! and use

ContentProvider the benefit of sharing data is: the same way the data access! This is the only way to share data across applications,

For a storage area that does not provide common access to all apps in Android! Well, actually also not so mysterious, below please follow the author's

Step to resolve Android ContentProvider!



Learning Roadmap for this section:




Body:


ContentProvider Overview and principles of implementation




Custom ContentProvider



Reference code:

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

Reference code Download: code Download



using System-provided ContentProvider




code example: Invoking system-provided SMS and contacts

Reference code Download: code Download



Monitor the ContentProvider data changes



PS: This code is an example of Li Gang's "Android Madness Handout", which is quoted here, this demo need to open the app and then send

Information To be able to monitor SMS content! In the background we will be in the following service to explain!


code sample download : code Download



Piglet's Android starter Road Day 7 Part 4

Related Article

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.