saving spinner state using sharedpreferences in android
I am developing an android app which gives access to a form via a login screen If user gets interrupted he can go back to the form via login screen To avoid effort by user I am implementing a SAVE button
I am saving the editText fields by using shared preferences with putstring class
How can I save the state of the SPINNERS using shared preferences?
开发者_如何转开发Please help me out
You can use spinner.getSelectedItemPosition();
that will return to you an int that you can save with prefEdit.putInt();
then when you want to re-load everything that has been saved you would just call spinner.setSelection(prefs.getInt("key", default));
精彩评论