This is probably a really easy question but Im extremely new to programming..
Could someone please explain to me how to save the answers (using a save button) chosen from several spinners in the SD card, I dont need a database or anything complicated like that. But then I also need a page to be able to see the answers.
So far my code just consists of 5 spinners and their options and thats it 开发者_如何学Go- code looks like this: http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/Spinner1.html
Thank you so much!
You should check out SharedPreferences. http://developer.android.com/reference/android/content/SharedPreferences.html
//Saving
SharedPreferences prefs = getSharedPreferences("YourPreferencesName", 0);
prefs.edit().putString("KeyValue", actual_variable);
prefs.commit();
//Retrieving data
String str = prefs.getString("YourPreferencesName", "DefaultValueIfPrefNotFound");
Didn't check the syntax so it might contain errors.
精彩评论