-3

I wanna make a pedometer app. But I don't know already how can i save or store step numbers for each day or each month.

Thanks for your help now.

piotrek1543
  • 19,130
  • 7
  • 81
  • 94
user3717742
  • 103
  • 1
  • 7

2 Answers2

1

Use SharedPreferences to save data:

 SharedPreferences sharedPreferences = getSharedPreferences("MyData", Context.MODE_PRIVATE);
 SharedPreferences.Editor editor = sharedPreferences.edit();
 //for save data
 editor.putString("yourDay", yourData);
 //for get data
 sharedPreferences.getString("yourDay", "yourDefaultData");

It is saved on SharePreference folder into your app data folder, and you can always access to it just using the same name when you instantiate your SharedPreference.

Josbel Luna
  • 2,574
  • 3
  • 17
  • 25
0

If you're looking to use a database to store the data locally (as in not through a web service) then start here: http://developer.android.com/training/basics/data-storage/databases.html

Owais Ali
  • 724
  • 1
  • 6
  • 14