#Android #Content Providers & its Creation in Easy #Steps

Published By Maria Desilva, 26 Oct 2017

#Android #Content Providers & its Creation in Easy #Steps

Content provider provides data from one application to another on their requests. These requests for data are handled by classes extending contentresolver class. Data in contentresolver class can be saved in various ways like in Database, Files, or even over Network.


Content providers helps in centralization of data at one place and letting other apps use it when they require. ContentProvider works similar to databases where we can insert, update delete, query for data, It allows other apps to perform these queries.


Now Let's Start with the code:-

Following are the steps to create a content provider:-

1. Create a class that extends ContentProvider class.

  • When you will extend this class, Some methods you will need to override.

  • Eg. onCreate(), delete(), getType(), insert(), query(), update().

2. You will need to handle all your queries in these methods only.

3. Declare content provider inside your manifest.

4. Add permissions inside your manifest for the content provider. 

5. Provide the permission to the client app.
Read here to click more>> What are Android Content Providers and How to Create in Easy Steps