Android Learning Note-contentprovider

Source: Internet
Author: User

1.ContentProvider provides a unified interface for storing and retrieving data

2. Use ContentProvider to share data between different applications

3.Android provides contentprovider for some common data (including audio, video, images, contacts, etc.)


ContentProvider to organize data using a table Form

_id number number_key label name type
11 1348729883 2001 ss yd type_work
12 15572706076 2011 s yy type_home

Functions provided by ContentProvider

Query () queries

Insert () insertion

Update () Updates

Delete () remove

GetType () Get data type

OnCreate () callback function at the time of creation


the process of realizing ContentProvider

1. Define a Content_uri constant

2. Define a class that inherits ContentProvider

3. Implement query Insert update Delete GetType onCreate

4. Declaration in Androidmanifest.xml

This article is from "Avatar" blog, please make sure to keep this source http://shamrock.blog.51cto.com/2079212/1581614

Android Learning Note-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.