Java Code Examples for android.widget.SpinnerAdapter#getItem()

The following examples show how to use android.widget.SpinnerAdapter#getItem() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AlarmDialog.java    From SuntimesWidget with GNU General Public License v3.0 6 votes vote down vote up
public void setChoice( SolarEvents choice )
{
    if (choice != null)
    {
        this.choice = choice;
        if (spinner_scheduleMode != null)
        {
            SpinnerAdapter adapter = spinner_scheduleMode.getAdapter();
            if (adapter != null)
            {
                for (int i = 0; i < adapter.getCount(); i++)
                {
                    SolarEvents event = (SolarEvents) adapter.getItem(i);
                    if (event.equals(choice))
                    {
                        spinner_scheduleMode.setSelection(i);
                        break;
                    }
                }
            }
        }
    }
}
 
Example 2
Source File: FileSelectorActivity.java    From PowerFileExplorer with GNU General Public License v3.0 5 votes vote down vote up
private void selectItemOfSpinner( Spinner spinner , String s )
{
    SpinnerAdapter adapter = spinner.getAdapter();
    int max = adapter.getCount();
    for( int i=0;i<max;i++ ){
        String item = (String)adapter.getItem(i);
        if ( s.equals(item) ){
            spinner.setSelection(i);
            break;
        }
    }
    return;
}
 
Example 3
Source File: RecurActivity.java    From financisto with GNU General Public License v2.0 5 votes vote down vote up
private void editRecur(Recur recur) {
    editStartDate(recur.startDate);
    RecurInterval interval = recur.interval;
    SpinnerAdapter adapter = sInterval.getAdapter();
    int count = adapter.getCount();
    for (int i = 0; i < count; i++) {
        SpinnerItem item = (SpinnerItem) adapter.getItem(i);
        if (interval == RecurInterval.valueOf(item.value)) {
            sInterval.setSelection(i);
            break;
        }
    }
    View v = selectInterval(interval);
    switch (interval) {
        case EVERY_X_DAY:
            editEveryXDay(v, recur);
            break;
        case WEEKLY:
            editWeekly(v, recur);
            break;
        case SEMI_MONTHLY:
            editSemiMonthly(v, recur);
            break;
    }
    RecurPeriod period = recur.period;
    sPeriod.setSelection(period.ordinal());
    v = selectPeriod(period);
    switch (period) {
        case EXACTLY_TIMES:
            editExactlyTimes(v, recur.periodParam);
            break;
        case STOPS_ON_DATE:
            editStopsOnDate(v, recur.periodParam);
            break;
    }
}
 
Example 4
Source File: FileSelectorActivity.java    From JotaTextEditor with Apache License 2.0 5 votes vote down vote up
private void selectItemOfSpinner( Spinner spinner , String s )
{
    SpinnerAdapter adapter = spinner.getAdapter();
    int max = adapter.getCount();
    for( int i=0;i<max;i++ ){
        String item = (String)adapter.getItem(i);
        if ( s.equals(item) ){
            spinner.setSelection(i);
            break;
        }
    }
    return;
}