开发者

Setting Spinner by name

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜