1

I am trying to make an app in which the user can store x number of alarm times.

The other next time the user opens it up, all the previous sequences of times are shown...he can select one sequence, total mumber of alarms, and change first alarm time.

I will be saving a maximum of 10 such sequences. Which will be better for storing this data...SharedPreferences or SQLite ?

tanvi
  • 927
  • 5
  • 17
  • 32

4 Answers4

2

if records is only limit to 10 then SharedPreferences is the best choice as it is easy,fast and quick to implement..

Mohsin Naeem
  • 12,542
  • 3
  • 39
  • 53
  • @M Mohsin Naeem two contradictory answers here...how do i know now? – tanvi Jul 07 '12 at 18:06
  • final decision will be yours :) but if you have `onyl 10` records then for SQLite you will implement SQLiteHelper class, make query, get Cursor, and then finally get your result..is a bad choice(my opinion) but in case of `SharedPreferences` you can put string array and read and change data with lesser nuber of lines..read this http://stackoverflow.com/questions/3876680/is-it-possible-to-add-an-array-or-object-to-sharedpreferences-on-android – Mohsin Naeem Jul 07 '12 at 18:16
1

use SQLite for your requirement here tutorial : SQLite tutorial and Document : Android SQLite document

RajaReddy PolamReddy
  • 22,428
  • 19
  • 115
  • 166
1

SharedPreferences are aimed for storing little amount of data, while SQLite is for storing a larger amount of data.

So for this case if you have only max 10 data every time then you may use SharedPreferences, but if you don't know about the number of data (may be it is dependent on your app user), then SQLite is the better choice.

Soumyadip Das
  • 1,781
  • 3
  • 16
  • 34
1

Shared Preferences is better for this case(max=10 times)

Vasilis Drosatos
  • 128
  • 1
  • 1
  • 11