Now that we’ve examined the general structure of the simple video list application,
and provided a way for clients to access our content provider, it’s
time to look at how the application both implements and consumes the
In the following sections, we provide a
high-level guide to tasks associated with writing a content
provider. We then provide an introduction to Android MVC and finish
with an explanation of the
Applications extend the
ContentProvider class to handle URIs
that refer to a particular type of data, such as MMS messages,
pictures, videos, and so forth. For example, for a content
provider class that handled videos, the
ContentProvider.insert method would insert data that described a video into a
SQLite table with columns appropriate for that information, such
as a title, description, and similar information.
Start writing your content provider by implementing the following two methods:
This method provides a hook to allow your content provider to initialize itself. Any code you want to run just once, such as making a database connection, should reside in this method.
String getType(Uri uri)
This method, given a URI, returns the MIME type of the data that this content provider provides at the given URI. The URI comes from the client application interested in accessing the data.
You’ll continue to implement ...