Code example for Spinner

Methods: getSelectedItem

0
        return mColorPicker.getColor();
    } 
 
    @SuppressWarnings("unchecked") 
    public int getPulseSpeedOn() { 
        return ((Pair<String, Integer>) mPulseSpeedOn.getSelectedItem()).second;
    } 
 
    @SuppressWarnings("unchecked") 
    public int getPulseSpeedOff() { 
        // return 0 if 'Always on' is selected 
        return getPulseSpeedOn() == 1 ? 0 : ((Pair<String, Integer>) mPulseSpeedOff.getSelectedItem()).second;
    } 
 
    class PulseSpeedAdapter extends BaseAdapter implements SpinnerAdapter {
        private ArrayList<Pair<String, Integer>> times;
 
        public PulseSpeedAdapter(int timeNamesResource, int timeValuesResource) {
            times = new ArrayList<Pair<String, Integer>>();
 
            String[] time_names = getContext().getResources().getStringArray(timeNamesResource);