質問

all are known difference between SQLite, Content provider and Shared Preference.

But i want to know when i need to use SQLite or Content provider or Shared Preference by situation.

Please explain with some examples.

役に立ちましたか?

解決

Its all depends on your data usage,

  • Content Provider is used to Share data between applications
  • SharedPreference is used to Store small size of information like "read me" option in Login page, where you store userId & password in SharedPreference to skip login screen in future
  • Sqlite is used when you have large size of structure data. Sqlite also allows you to use query for searching particular data.

他のヒント

shared preferences are the location where you can store the secret information for your app, like setting cookies in the browser, this can be used for login credentials and other.

where as content provider stores and retrieves the data and make it available to other applications also. like suppose you want to access the contacts available in the android phone, they can be accessed by content providers

Reference Links: Difference between Shared Preferences and Content Providers in android

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top