开发者

saving spinner state using sharedpreferences in android

开发者 https://www.devze.com 2023-03-05 05:09 出处:网络
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

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

精彩评论

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