Change a Spinner programmatically in Android
Im trying to add a Spinner in my app configuration Activity. The spinner offers an option and save 开发者_JS百科it persistently with SharedPreferences.
How can I set the spinner in a position programmatically (for init in the activity creation) Thanks in advance
To programatically set the spinner position you should use the method:
setSelection(position_to_select)
From the Spinner class (Actually the method's implementation is from the android.widget.AbsSpinner but it is inherited by Spinner class.
You can check the API documentation for it here: http://developer.android.com/reference/android/widget/Spinner.html
精彩评论