Implementing Content Providers
We've discussed how to interact with a content provider for data needs but haven't yet discussed how to write a content provider. To write a content provider, you have to extend
android.content.ContentProvider and implement the following key methods:
query insert update delete getType
You'll also need to set up a number of things before implementing them. We will illustrate all the details of a content-provider implementation by describing the steps you'll need to take:
- Plan your database, URIs, column names, and so on, and create a metadata class that defines constants for all of these metadata elements.
- Extend the abstract class
- Implement these methods: