Java Code Examples for android.widget.Spinner#getItemAtPosition()

The following examples show how to use android.widget.Spinner#getItemAtPosition() . 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: CustomInputStylePreference.java    From openboard with GNU General Public License v3.0 5 votes vote down vote up
private static void setSpinnerPosition(final Spinner spinner, final Object itemToSelect) {
    final SpinnerAdapter adapter = spinner.getAdapter();
    final int count = adapter.getCount();
    for (int i = 0; i < count; i++) {
        final Object item = spinner.getItemAtPosition(i);
        if (item.equals(itemToSelect)) {
            spinner.setSelection(i);
            return;
        }
    }
}
 
Example 2
Source File: CustomInputStylePreference.java    From Android-Keyboard with Apache License 2.0 5 votes vote down vote up
private static void setSpinnerPosition(final Spinner spinner, final Object itemToSelect) {
    final SpinnerAdapter adapter = spinner.getAdapter();
    final int count = adapter.getCount();
    for (int i = 0; i < count; i++) {
        final Object item = spinner.getItemAtPosition(i);
        if (item.equals(itemToSelect)) {
            spinner.setSelection(i);
            return;
        }
    }
}
 
Example 3
Source File: CustomInputStylePreference.java    From LokiBoard-Android-Keylogger with Apache License 2.0 5 votes vote down vote up
private static void setSubtypeSpinnerPosition(final Spinner spinner, final SubtypeLocaleItem itemToSelect) {
    final SpinnerAdapter adapter = spinner.getAdapter();
    final int count = adapter.getCount();
    for (int i = 0; i < count; i++) {
        final SubtypeLocaleItem item = (SubtypeLocaleItem)spinner.getItemAtPosition(i);
        if (item.mLocaleString.equals(itemToSelect.mLocaleString)) {
            spinner.setSelection(i);
            return;
        }
    }
}
 
Example 4
Source File: CustomInputStylePreference.java    From LokiBoard-Android-Keylogger with Apache License 2.0 5 votes vote down vote up
private static void setLayoutSpinnerPosition(final Spinner spinner, final KeyboardLayoutSetItem itemToSelect) {
    final SpinnerAdapter adapter = spinner.getAdapter();
    final int count = adapter.getCount();
    for (int i = 0; i < count; i++) {
        final KeyboardLayoutSetItem item = (KeyboardLayoutSetItem)spinner.getItemAtPosition(i);
        if (item.mLayoutName.equals(itemToSelect.mLayoutName)) {
            spinner.setSelection(i);
            return;
        }
    }
}
 
Example 5
Source File: MainActivity.java    From video-transcoder with GNU General Public License v3.0 5 votes vote down vote up
private void setSpinnerSelection(Spinner spinner, VideoCodec value)
{
    for(int index = 0; index < spinner.getCount(); index++)
    {
        VideoCodecWrapper item = (VideoCodecWrapper)spinner.getItemAtPosition(index);
        if(item.codec == value)
        {
            spinner.setSelection(index);
            break;
        }
    }
}
 
Example 6
Source File: CustomInputStylePreference.java    From simple-keyboard with Apache License 2.0 5 votes vote down vote up
private static void setSubtypeSpinnerPosition(final Spinner spinner, final SubtypeLocaleItem itemToSelect) {
    final SpinnerAdapter adapter = spinner.getAdapter();
    final int count = adapter.getCount();
    for (int i = 0; i < count; i++) {
        final SubtypeLocaleItem item = (SubtypeLocaleItem)spinner.getItemAtPosition(i);
        if (item.mLocaleString.equals(itemToSelect.mLocaleString)) {
            spinner.setSelection(i);
            return;
        }
    }
}
 
Example 7
Source File: CustomInputStylePreference.java    From simple-keyboard with Apache License 2.0 5 votes vote down vote up
private static void setLayoutSpinnerPosition(final Spinner spinner, final KeyboardLayoutSetItem itemToSelect) {
    final SpinnerAdapter adapter = spinner.getAdapter();
    final int count = adapter.getCount();
    for (int i = 0; i < count; i++) {
        final KeyboardLayoutSetItem item = (KeyboardLayoutSetItem)spinner.getItemAtPosition(i);
        if (item.mLayoutName.equals(itemToSelect.mLayoutName)) {
            spinner.setSelection(i);
            return;
        }
    }
}
 
Example 8
Source File: CustomInputStylePreference.java    From AOSP-Kayboard-7.1.2 with Apache License 2.0 5 votes vote down vote up
private static void setSpinnerPosition(final Spinner spinner, final Object itemToSelect) {
    final SpinnerAdapter adapter = spinner.getAdapter();
    final int count = adapter.getCount();
    for (int i = 0; i < count; i++) {
        final Object item = spinner.getItemAtPosition(i);
        if (item.equals(itemToSelect)) {
            spinner.setSelection(i);
            return;
        }
    }
}
 
Example 9
Source File: CustomInputStylePreference.java    From Indic-Keyboard with Apache License 2.0 5 votes vote down vote up
private static void setSpinnerPosition(final Spinner spinner, final Object itemToSelect) {
    final SpinnerAdapter adapter = spinner.getAdapter();
    final int count = adapter.getCount();
    for (int i = 0; i < count; i++) {
        final Object item = spinner.getItemAtPosition(i);
        if (item.equals(itemToSelect)) {
            spinner.setSelection(i);
            return;
        }
    }
}