Android examples for User Interface:Spinner
set Spinner Item
import android.widget.ArrayAdapter; import android.widget.Spinner; public class Main { public static void setSpinnerItem(Spinner spinner, String value) { if (spinner != null && value != null) { if (spinner.getAdapter() instanceof ArrayAdapter) { ArrayAdapter<String> adapter = (ArrayAdapter<String>) spinner .getAdapter();//from ww w . j ava2 s .c om for (int position = 0; position < adapter.getCount(); position++) { if (adapter.getItem(position).equals(value)) { spinner.setSelection(position); return; } } } } } }