I\'m having some problem with setSelection on a Spinner. I set the value to be pre-selected when the spinner is shown in code, but it has no effect and the first alternative
None of the previous answers worked for me. What did work, though, was creating the instance variable mSpinner in the onCreateView() method of my fragment (or in the onCreate() method of your activity), then doing this in my onLoadFinished() method...
@Override
public void onLoadFinished(Loader loader, Cursor cursor) {
adapter.swapCursor(cursor);
//mSpinner.setAdapter(adapter);
mSpinner.setSelection(mSelectedIndex);
}