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