Skip to main content

Posts

Showing posts from June, 2015

Use a content provider

Its like bridge/proxy between java db and our/other app.   if content provider is there for a db then its really easy to access data from the db without coding directly for the db. Content resolver is provides the info for Content provider for where to access the info. A URI is needed to connect between the two.   Initial steps are to create three classes: Contract, Database and Provider Database class handles the actual db i.e CRUD operations Contract class contains all the info that is required by the Content Provider. Each content provider shold have a separate contract class.   Contract class explanation so its contains the interface containg column names of the table which are supposed to be accessed. then the name of Content authority for the Content provider (e.g org.example.myapp.provider) then the URI is to built which starts as “content://+CONTENT_AUTHORITY” as the base URI then the path i.e the table name then we have array of strings contain...