1. Content Providers
A content provider manages access to a central repository of data.
A provider is part of a Android application, which often provides it own UI for working with the data. However, content providers is primarily
intended to is used by other applications, which access the provider using a Provider client object. Together, providers and provider clients
offer a consistent, standard interface to data, also handles inter-process communication and secure data access.
2. Overview
2.1 Accessing a provider
An application accesses the data from a content provider with a ContentResolver
client object. This object has methods the call
Identically-named methods in the provider object, an instance of one of the concrete subclasses ContentProvider
of. The
ContentResolver
Methods provide the basic "CRUD" (Create, retrieve, update, and delete) functions of persistent storage.
2.2 Content URIs
A content URI is a URI, which identifies data in a provider. Content URIs include the symbolic name of the entire provider (its authority)
and a name, points to a table (a path). When you call a client method to access a table in a provider, the content URI for the
Table is one of the arguments.
3. Retrieving Data from the Provider
To retrieve data from a provider, follow these basic steps:
<1> Request The Read access permission for the provider.
<2> Define The code that sends a query to the provider
3.1 Requesting Read Access Permission
To retrieve data from a provider, your application needs "Read access permission" for the provider
3.2 Constructing the query
3.3 Displaying Qurey Results
3.4 Getting data from Qurey results
3.APP components-content Providers