开发者

Setting Spinner by name

开发者 https://www.devze.com 2023-02-20 04:34 出处:网络
can any one tell hw to set a spinner by name.. The scenario is like this, Spinner contains three elements \"one\",\"two\",\"three\". After clicking the spin开发者_如何学JAVAner im storing thatin shard

can any one tell hw to set a spinner by name.. The scenario is like this, Spinner contains three elements "one","two","three". After clicking the spin开发者_如何学JAVAner im storing that in shard pref say "two" Now i wan to set to that spinner again to "two", if i open that activity again. Array of the elements is in values/arrays


Rather than storing the string value in your SharedPreferences, store the position within the array as an integer. Then you just call Spinner.setSelection(int position) with that value.

0

精彩评论

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