Search code examples
androidsqliteandroid-contentprovider

Exact Difference between "Content-Provider" and "SQLite Database"


i have done SQLite database programming for Android, but i dont know anything about Content-Provider except this: "As i have referred Android Developer page , Android SDK explained about "Content-provider" as it is used to store and retrieve data."

But then,

  1. What is the exact difference between "Content-Provider" and "SQLite Database"?
  2. Which is best to store data, when ?

Any example or helps !!


Solution

  • I found one major difference, as follows:

    Storing your data in a database is one good way to persist your data, but there's a caveat in Android-databases created in Android are visible only to the application that created them. That is to say, a SQLite database created on Android by one application is usable only by that application, not by other applications.

    So, if you need to share data between applications, you need to use the content provider model as recommended in Android. This article presents the basics of content providers and how you can implement one.

    I found this article at this link

    Really nice information provided.