Content Provider Andriod
Content Provider Andriod
Content
Providers
Lesson 11
● What is a ContentProvider
● App with Content Provider Architecture
● Implementation
○ Contract
○ ContentProvider
○ Manifest Permissions
○ Content Resolver
Contract specifies
● URIs to query data
● Table structure of data
● MIME type of returned data
● Constants
Content This work is licensed under a Creative
Android Developer Fundamentals Providers
Commons Attribution-NonCommercial 13
4.0 International License
Content Provider
● http:// and file:// are URIs for web pages and files
● Content URI is path to data and uses content://
content://com.android.example.wordcontentprovider.provider/words
scheme://authority/path/id
● AUTHORITY—Domain
● CONTENT_PATH—Path to the data
● CONTENT_URI—URI to one set of data
Multiple words
vnd.android.cursor.dir/vnd.com.example.provider.words
One word
vnd.android.cursor.item/vnd.com.example.provider.words
<provider
android:name=".WordListContentProvider"
android:authorities=
"com.android.example.wordlistsqlwithcontentprovider.provider"
android:exported="true" />
android:readPermission=
"com.android.example.wordlistsqlwithcontentprovider.PERMISSION"
android:writePermission=
"com.android.example.wordlistsqlwithcontentprovider.PERMISSION"
<uses-permission android:name =
"com.android.example.wordlistsqlwithcontentprovider.PERMISSION"/>
Activity
● ContentResolver.query()
● ContentResolver.insert()
● ContentResolver.delete()
● ContentResolver.update()