Android Learning _contentprovider

Source: Internet
Author: User

Create a ContentProvider

ContentProvider is an interface for unified publishing data, and all programs can use Contentresolver to receive data

1. Create a contentprovider that needs to be extended from the abstract class

public class Mycontentprovider extends ContentProvider

2. Register in the Mainifest file and set a android:authorities= "package name address";

3. Publish the URI address of the ContentProvider

 Public Static Final Uri Content_uri =             uri.parse ("Content://com.rain.bus/mycontentprovider");

A contentresolver may query all rows through Content://com.rain.bus/mycontentprovider, or use content://com.rain.bus/ MYCONTENTPROVIDER/5 to access specific rows, it is best to determine both of these form of request, and the simplest approach is to use a urimatcher to determine whether to request all data or to request a single row of data.

Cond...

Android Learning _contentprovider

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.