Kostya hit the nail on the head: the biggest benefit provided by
ContentProvider and ContentResolver is probably just that, that it
provides lifecycle management on top of database queries.

There are also other benefits, such as insulating from the particulars
of database, but since we are tied to SQLite3 anyway, I don't see this
as nearly as big. Plus, it is a nuisance that the interface 'leaks' a
cursor -- forcing you to make it look like a database even in the rare
case where there is no database behind the ContentProvider:(

But that lifecycle management is a major benefit, since you really
would not want to handle releasing and re-acquiring database
connections etc. all on your own without that support.

ContentProvider also provides consistent means for sharing data
between applications, not just between application components of a
single activity.

On Aug 9, 2:36 am, Sohan badaya <[email protected]> wrote:
> Hi All,
>
> I have a doubt about content provider. Why we use content provider?
> can't we use database of a application?
> If we talk about other application also. can't we use database of that
> application directly wihout
> content provider?
>
> Thanks,
> Sohan

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to