Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 !!

like image 374
Paresh Mayani Avatar asked Jul 28 '10 06:07

Paresh Mayani


People also ask

Is SQLite a content provider?

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.

Is content provider a database?

In Android, Content Providers are a very important component that serves the purpose of a relational database to store the data of applications.

What is difference between shared preferences and SQLite?

Shared preferences can only store key-value pairings whilst an SQLite database is much more flexible. So shared preferences are particularly useful for storing user preferences, e.g. should the app display notifications etc. Whilst an SQLite database is useful for just about anything.


1 Answers

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.

like image 186
Paresh Mayani Avatar answered Oct 16 '22 23:10

Paresh Mayani