The applications access the data from the other applications content providers using the content resolver object. Content Resolver runs as a client object and allow the CRUD (Create, Retrieve,Update and Delete) operations.
Content Provider Provides an abstract layer to query the data as table and hide the internal repository of application data. The Content Providers automatically handles the inter-process communication.
Note : To access the applications content provider the client application must need to specify the permissions in manifest file.
The ContentResolver object has methods identical to the ContentProvider and when resolver calls a method the identical name method will be invoked in ContentProvider Object.
The ContentResolver object ha a query method to pass a request to the ContentProvider Object.
// Queries the user dictionary and returns results mCursor = getContentResolver().query( UserDictionary.Words.CONTENT_URI, // The content URI of the words table mProjection, // The columns to return for each row mSelectionClause // Selection criteria mSelectionArgs, // Selection criteria mSortOrder); // The sort order for the returned rowsSee the argument list for the query method
query() argument | SELECT keyword/parameter | Description |
---|---|---|
Uri | FROM table_name | Uri defines the content provider table_name |
projection | col,col,col,... | projection is an array of columns for select list |
selection | WHERE col =value | selection specifies the filter criteria for selecting rows. |
selectionArgs | ||
sortOrder | ORDER BY col,col,... | sortOrder specifies the order in which rows appear in the returned Cursor. |
No comments:
Post a Comment