Java Code Examples for android.widget.Spinner#getAdapter()
The following examples show how to use
android.widget.Spinner#getAdapter() .
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: SpinnerActivityTest.java From androidtestdebug with MIT License | 5 votes |
@Override protected void setUp() throws Exception { /* * Call the super constructor (required by JUnit) */ super.setUp(); /* * prepare to send key events to the app under test by turning off touch mode. * Must be done before the first call to getActivity() */ setActivityInitialTouchMode(false); /* * Start the app under test by starting its main activity. The test runner already knows * which activity this is from the call to the super constructor, as mentioned * previously. The tests can now use instrumentation to directly access the main * activity through mActivity. */ mActivity = getActivity(); /* * Get references to objects in the application under test. These are * tested to ensure that the app under test has initialized correctly. */ mSpinner = (Spinner)mActivity.findViewById(com.android.example.spinner.R.id.Spinner01); mPlanetData = mSpinner.getAdapter(); }
Example 2
Source File: FileSelectorActivity.java From JotaTextEditor with Apache License 2.0 | 5 votes |
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: NewPadActivity.java From padland with Apache License 2.0 | 5 votes |
/** * Gets the default value from user settings and selects it in the * spinner. This value can be changed in the settings activity. */ private void _setSpinnerDefaultValue(){ String default_server = this._getDefaultSpinnerValue(); // We get position and set it as default Spinner spinner = findViewById( R.id.spinner ); ArrayAdapter adapter = (ArrayAdapter) spinner.getAdapter(); spinner.setSelection( adapter.getPosition( default_server ) ); }
Example 4
Source File: CustomInputStylePreference.java From Indic-Keyboard with Apache License 2.0 | 5 votes |
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 5
Source File: DetailFragment.java From kolabnotes-android with GNU Lesser General Public License v3.0 | 5 votes |
void setSpinnerSelection(String notebookSummary){ Spinner spinner = (Spinner) activity.findViewById(R.id.spinner_notebook); SpinnerAdapter adapter = spinner.getAdapter(); for(int i=0;i<adapter.getCount();i++){ String nbsummary = adapter.getItem(i).toString(); if(nbsummary.equals(notebookSummary)){ spinner.setSelection(i); break; } } }
Example 6
Source File: TrackIconUtils.java From mytracks with Apache License 2.0 | 5 votes |
public static void setIconSpinner(Spinner spinner, String iconValue) { @SuppressWarnings("unchecked") ArrayAdapter<StringBuilder> adapter = (ArrayAdapter<StringBuilder>) spinner.getAdapter(); StringBuilder stringBuilder = adapter.getItem(0); stringBuilder.delete(0, stringBuilder.length()); stringBuilder.append(iconValue); adapter.notifyDataSetChanged(); }
Example 7
Source File: CustomInputStylePreference.java From AOSP-Kayboard-7.1.2 with Apache License 2.0 | 5 votes |
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 8
Source File: CustomInputStylePreference.java From simple-keyboard with Apache License 2.0 | 5 votes |
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 9
Source File: CustomInputStylePreference.java From simple-keyboard with Apache License 2.0 | 5 votes |
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 10
Source File: FileSelectorActivity.java From PowerFileExplorer with GNU General Public License v3.0 | 5 votes |
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 11
Source File: CustomInputStylePreference.java From LokiBoard-Android-Keylogger with Apache License 2.0 | 5 votes |
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 12
Source File: CustomInputStylePreference.java From LokiBoard-Android-Keylogger with Apache License 2.0 | 5 votes |
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 13
Source File: CustomInputStylePreference.java From Android-Keyboard with Apache License 2.0 | 5 votes |
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 14
Source File: CustomInputStylePreference.java From openboard with GNU General Public License v3.0 | 5 votes |
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 15
Source File: AccountBillingInfoFragment.java From arcusandroid with Apache License 2.0 | 4 votes |
private void setSpinnerByValue(Spinner spinner, String value){ ArrayAdapter<CharSequence> arrayAdapter = (ArrayAdapter<CharSequence>) spinner.getAdapter(); int spinnerPosition = arrayAdapter.getPosition(value); spinner.setSelection(spinnerPosition); }
Example 16
Source File: TGMeasureCopyDialog.java From tuxguitar with GNU Lesser General Public License v2.1 | 4 votes |
@SuppressWarnings("unchecked") public void updateSpinnerSelection(Spinner spinner, int selection) { ArrayAdapter<TGSelectableItem> adapter = (ArrayAdapter<TGSelectableItem>) spinner.getAdapter(); spinner.setSelection(adapter.getPosition(new TGSelectableItem(Integer.valueOf(selection), null)), false); }
Example 17
Source File: TGMeasureRemoveDialog.java From tuxguitar with GNU Lesser General Public License v2.1 | 4 votes |
@SuppressWarnings("unchecked") public void updateSpinnerSelection(Spinner spinner, int selection) { ArrayAdapter<TGSelectableItem> adapter = (ArrayAdapter<TGSelectableItem>) spinner.getAdapter(); spinner.setSelection(adapter.getPosition(new TGSelectableItem(Integer.valueOf(selection), null)), false); }
Example 18
Source File: TGMeasureCleanDialog.java From tuxguitar with GNU Lesser General Public License v2.1 | 4 votes |
@SuppressWarnings("unchecked") public void updateSpinnerSelection(Spinner spinner, int selection) { ArrayAdapter<TGSelectableItem> adapter = (ArrayAdapter<TGSelectableItem>) spinner.getAdapter(); spinner.setSelection(adapter.getPosition(new TGSelectableItem(Integer.valueOf(selection), null)), false); }
Example 19
Source File: PlaceAccountBillingInfoFragment.java From arcusandroid with Apache License 2.0 | 4 votes |
private void setSpinnerByValue(Spinner spinner, String value){ ArrayAdapter<CharSequence> arrayAdapter = (ArrayAdapter<CharSequence>) spinner.getAdapter(); int spinnerPosition = arrayAdapter.getPosition(value); spinner.setSelection(spinnerPosition); }
Example 20
Source File: SpinnerActivityTest.java From codeexamples-android with Eclipse Public License 1.0 | 3 votes |
@Override protected void setUp() throws Exception { super.setUp(); setActivityInitialTouchMode(false); mActivity = getActivity(); mSpinner = (Spinner) mActivity .findViewById(com.android.example.spinner.R.id.Spinner01); mPlanetData = mSpinner.getAdapter(); }