-1

I wanna make an app kind of like Google keep, which has these features:

  1. Storing the names, content, background color of every notes and photos (not including to-do lists, it's a little complicated), using TextView for notes, Custom View (TextView + ImageView) for photos;

  2. Entries could change position with each other by drag and drop;

  3. It could only save 10 entries at most. If there exists opening entry position, The app will fill the position with placeholder, and display all the 10 position in one screen (no scrollbar).

In my opinion, both method have some shortcomings for this situation:

Sharedpreferences: the amount of data is too much and kind of complex;

Sqlite: the data entries are limited. Besides, I think TableLayout is more suitable than GridView cus I want them display in one screen without scrollbar.

Then which data storage method should I choose, sqlite or sharedpreferences? Thanks for your help.

4

1 回答 1

0

SharedPreferences 不适合。正如您所注意到的,它不适用于如此数量和复杂性的数据。顾名思义,它用于存储用户的偏好,而不是他们的数据。

请注意,SQLite 支持可用于存储图像等的 BLOB 类型。

但您不仅限于这两个选项。第三个选项是将您的数据以您选择的任何格式存储在一个文件中,例如,您可以将您的 Java 对象序列化为一个文件。由于您将处理有限数量的数据,因此您不一定需要 SQLite 的功能。

但总的来说,我认为 SQLite 是你最好的选择。由于上面给出的原因,它比 SharedPreferences 更好,并且比第 3 个选项更好,因为它内置在 Android 中并且被广泛使用。

于 2013-04-24T15:29:24.307 回答