tags:

views:

312

answers:

1

Hi,

Is it possible to create a custom ContentProvider to * access android existing database (e.g. Contacts, SMS)? * extend an Exciting ContentProvider which has access to android existing database (e.g. ContactsProvider to access Contacts DB)?

Thank you.

+1  A: 

Short Answer: Yes

Longer answer:

ContentProviders are a layer sitting in between the "outside world" (e.g. other Android Activities) and the back-end data storage. You will never have direct access to the database. The database is stored in the Activities private storage space. So all you can do is dictated by the ContentProvider you are addressing.

If the ContentProvider only allows read-only access to the data, than that is all you can do.

So in the end, you can only offer access which has at most the kind of access as the ContentProvider you are using. You can however expose a different data structure. Or you could also create one ContentProvider which uses multiple other providers internally.

On the bottom line, within the given bounds, your imagination is the limit.

exhuma