SpinnerOption.java revision 8978aac1977408b05e386ae846c30920c7faa0a6
1/**
2 *
3 */
4
5package com.android.email.activity.setup;
6
7import android.widget.Spinner;
8
9public class SpinnerOption {
10    public Object value;
11
12    public String label;
13
14    public static void setSpinnerOptionValue(Spinner spinner, Object value) {
15        for (int i = 0, count = spinner.getCount(); i < count; i++) {
16            SpinnerOption so = (SpinnerOption)spinner.getItemAtPosition(i);
17            if (so.value.equals(value)) {
18                spinner.setSelection(i, true);
19                return;
20            }
21        }
22    }
23
24    public SpinnerOption(Object value, String label) {
25        this.value = value;
26        this.label = label;
27    }
28
29    @Override
30    public String toString() {
31        return label;
32    }
33}
34