Java tutorial
//package com.java2s; import android.support.v4.widget.SimpleCursorAdapter; import android.widget.Spinner; public class Main { public static void setSpinnerSelectionById(Spinner spinner, int itemId) { SimpleCursorAdapter adapter = (SimpleCursorAdapter) spinner.getAdapter(); for (int position = 0; position < adapter.getCount(); position++) { if (adapter.getItemId(position) == itemId) { spinner.setSelection(position); return; } } spinner.setSelection(0); } }