开发者

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));

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜