Android Default selection in spinner?

At the moment when viewing the spinner again, it automatically selects the first item" The previously selected item should be selected by the spinner, so make sure you ain't repopulate your spinner every time.

You need to add an OnItemSelectedListener listener to the Spinner to save the current selected item's position. Then you can call spinner. SetSelection(position); to restore the spinner to the selected position.

And you should only need to do this is you want the selected item to preserve state over multiple app sessions. You will also need to save the selected item using SharedPreferences. Spinner.

SetOnItemSelectedListener(new OnItemSelectedListener() { public void onItemSelected(AdapterView parent, View v, int pos, long row) { mSelectedPosition = pos; mSelectedItem = mItems. Get(pos); } }).

– user319940 Mar 21 at 13:37 If the id will always be the same position in the list then that should work. – Robby Pond Mar 21 at 13:38.

You need to add an OnItemSelectedListener listener to the Spinner to save the current selected item's position. Then you can call spinner. SetSelection(position); to restore the spinner to the selected position.

And you should only need to do this is you want the selected item to preserve state over multiple app sessions. You will also need to save the selected item using SharedPreferences.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions