Jakob Harteg
Jakob Harteg

Reputation: 9747

SharedPreferences or SQlite

I'm developing an Android AppWidget which displays a short text inputted from the configuration activity. I'm a bit confused when it's comes to storing the data, should I use sharedpreferences or SQlite Database?

Thanks

Upvotes: 3

Views: 1308

Answers (4)

Mohsin Naeem
Mohsin Naeem

Reputation: 12642

It totally depend on your data, which you want to store.

sharedpreferences

  • Small data
  • Unstructured
  • Like login info, user preffs, etc

Sqlite

  • large data
  • Structured
  • Organized

Upvotes: 4

Jason Hessley
Jason Hessley

Reputation: 1628

For a single string SharedPrefs will be much simpler.

Upvotes: 0

Depends on the data you're planning to store. If it's quite simple, sharedPreferences would do the job. If it's more complicated use DB.

Upvotes: 0

fedepaol
fedepaol

Reputation: 6862

It depends on the data you want to store. With sharedPreferences you can store name - value data, with sqlite you have all the power of a relational database.

I'd say it depends on the amount of data and on the kind of query you need to perform on that.

Upvotes: 0

Related Questions