Components: 4.Content Providers
Content Providers:
Content providers store and retrieve data and make it accessible to all applications. They're the only way to share data across applications; there's no common storage area that all Android packages can access.
manner that makes sense
> Delete
> Update
> Insert
> A ContentResolver can talk to any content provider
Content providers store and retrieve data and make it accessible to all applications. They're the only way to share data across applications; there's no common storage area that all Android packages can access.
- They are used to share data with other applications.
manner that makes sense
- Content provider is the only way to share data between Android applications
- Content provider uses a standard interface (URI) to fulfill requests for data from other applications/services
- Content provider extends ContentProvider base class and implements a standard set of methods to allow access to a data store
> Delete
> Update
> Insert
- Applications do not call these methods directly
> A ContentResolver can talk to any content provider
- Content is represented by URI and MIME type
Content URI Summary
Here is a recap of the important parts of a content URI:- Standard prefix indicating that the data is controlled by a content provider. It's never modified.
- The authority part of the URI; it identifies the content provider. For third-party applications, this should be a fully-qualified class name (reduced to lowercase) to ensure uniqueness. The authority is declared in the
<provider>
element'sauthorities
attribute:
<provider android:name=".TransportationProvider" android:authorities="com.example.transportationprovider" . . . >
- The path that the content provider uses to determine what kind of data is being requested. This can be zero or more segments long. If the content provider exposes only one type of data (only trains, for example), it can be absent. If the provider exposes several types, including subtypes, it can be several segments long — for example, "
land/bus
", "land/train
", "sea/ship
", and "sea/submarine
" to give four possibilities. - The ID of the specific record being requested, if any. This is the
_ID
value of the requested record. If the request is not limited to a single record, this segment and the trailing slash are omitted:
content://com.example.transportationprovider/trains
Comments
Post a Comment
Please post comments here:-)