Java tutorial
//package com.java2s; import android.util.Log; import android.view.View; import android.widget.Spinner; public class Main { public static String GetSpinnerValue(Spinner sp) { if (sp.getVisibility() == View.VISIBLE) { Log.e("Error in Get Spinner : ", String.valueOf(sp.getId())); return ((sp).getSelectedItem().toString().substring(0, (sp).getSelectedItem().toString().lastIndexOf(":"))).trim(); } else { return ""; } } }