SharedPreferences or SQlite

后端 未结 4 746
Happy的楠姐
Happy的楠姐 2021-01-20 15:51

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

相关标签:
4条回答
  • 2021-01-20 16:24

    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
    0 讨论(0)
  • 2021-01-20 16:32

    For a single string SharedPrefs will be much simpler.

    0 讨论(0)
  • 2021-01-20 16:34

    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.

    0 讨论(0)
  • 2021-01-20 16:47

    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.

    0 讨论(0)
提交回复
热议问题