Best code examples for Android Spinner class (android.widget.Spinner)

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android Spinner class.
You can now enable Codota on your own code to easily search and navigate your Java codebase.

Android Spinner examples from Open Source projects
This code example shows how to use the following methods: getBottom, getLeft, getRight
49:	assertTrue(list.getTop()>=spinner.getBottom()); 
50:	assertTrue(list.getLeft()==spinner.getLeft()); 
51:	assertTrue(list.getRight()==spinner.getRight()); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: getPrompt, setPrompt
24:	spinner.setPrompt("foo"); 
-
26:	assertThat(spinner.getPrompt().toString()).isEqualTo("foo"); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getBottom, getLeft, getRight
49:	assertTrue(list.getTop()>=spinner.getBottom()); 
50:	assertTrue(list.getLeft()==spinner.getLeft()); 
51:	assertTrue(list.getRight()==spinner.getRight()); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setEnabled
56:	spinner.setEnabled(enabled); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods:
33:	spinner = new Spinner(context); 
34:	shadowSpinner = (ShadowAbsSpinner) Robolectric.shadowOf(spinner); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setAdapter
346:	Spinner spinner = new Spinner( null ); 
-
348:	spinner.setAdapter( new LookupArrayAdapter<String>( null, lookupList, null ) ); 
349:	assertEquals( "foo", androidWidgetBuilder.getValue( spinner ) ); 
350:	androidWidgetBuilder.setValue( "bar", spinner ); 
351:	assertEquals( "bar", androidWidgetBuilder.getValue( spinner ) ); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getSelectedView, setAdapter
61:	mView.setAdapter(adapter); 
-
78:	View selected = mView.getSelectedView(); 
Full Snippet Info
9
CodeRank
This code example shows how to use the following methods: setAdapter, setOnItemSelectedListener
55:	mGroupSpinner.setAdapter(mGroupAdapter); 
56:	mGroupSpinner.setOnItemSelectedListener(this); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getAdapter
42:	assertTrue(spinner.getAdapter().getCount()==3); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setSelection, setAdapter, setOnItemSelectedListener
64:	spin = new Spinner(context); 
-
68:	spin.setOnItemSelectedListener(new OnItemSelectedListener() { 
-
104:	spin.setAdapter(adapter); 
105:	spin.setSelection((int) field.getDouble(idx)); 
-
118:	spin.setSelection((int) val); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setAdapter
163:	mSupportedLanguageView.setAdapter(adapter); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getAdapter, setSelection
69:	String option1 = (String) spinner.getAdapter().getItem(1); 
70:	spinner.setSelection(1); 
-
74:	String option2 = (String) spinner.getAdapter().getItem(2); 
75:	spinner.setSelection(2); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setEnabled
140:	mInterval.setEnabled(enable); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getSelectedItem
23:	Object selectedItem = foundView.getSelectedItem(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getCount, getItemAtPosition
137:	assertEquals("broadcastWaitSpinner has not the correct number of elements", 2, spinner.getCount()); 
-
139:	solo.getString(R.string.new_broadcast_message), spinner.getItemAtPosition(0)); 
140:	assertEquals("First broadcast message isn't" + broadcastMessage, broadcastMessage, spinner.getItemAtPosition(1)); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getBottom, getLeft, getRight
49:	assertTrue(list.getTop()>=spinner.getBottom()); 
50:	assertTrue(list.getLeft()==spinner.getLeft()); 
51:	assertTrue(list.getRight()==spinner.getRight()); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setSelection, setAdapter
73:	spinner.setSelection(idx); 
-
96:	spinner = new Spinner(ctx); 
97:	spinner.setAdapter(getAdapter(ctx, 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getAdapter
42:	assertTrue(spinner.getAdapter().getCount()==3); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: requestFocus, setSelection
53:	mSpinner.requestFocus(); 
54:	mSpinner.setSelection(0); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setAdapter, setOnItemSelectedListener
47:	spinner = new Spinner(context); 
-
52:	addView(spinner); 
53:	spinner.setOnItemSelectedListener(this); 
-
55:	spinner.setAdapter(adapter); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getContext
33:	return spinner.getContext().getResources() 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getSelectedItem, getSelectedItemPosition
67:	if (msTextMatches.getSelectedItemPosition() == AdapterView.INVALID_POSITION) { 
-
73:	int noOfMatches = Integer.parseInt(msTextMatches.getSelectedItem() 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getSelectedItem
49:	T selection = (T) spinner.getSelectedItem(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getContext, getSelectedItem
13:	if (spinner.getSelectedItem() == null) 
14:	mc.registerFieldError(spinner, getFormattedFeedbackMessageString(spinner.getContext())); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setSelection, setAdapter, getSelectedItemPosition
118:	Spinner spinner = new Spinner( activity ); 
-
124:	spinner.setAdapter( adapter ); 
125:	spinner.setSelection( 3 ); 
-
130:	setter.execute( spinner, props ); 
-
132:	assertEquals( 0, spinner.getSelectedItemPosition() ); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setLayoutParams, setAdapter, setOnItemSelectedListener
27:	picker = new Spinner(context); 
28:	picker.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT, 0.25f)); 
-
33:	picker.setOnItemSelectedListener(listener); 
34:	picker.setAdapter(adapter); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setAdapter
86:	((ViewGroup) container.getPlatformContainer()).getContext()); 
87:	container.add(_spinner); 
-
143:	_spinner.setAdapter(adapter); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: getSelectedItemPosition
28:	int position = spinner.getSelectedItemPosition(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setLayoutParams, setAdapter
148:	spinner = new Spinner(ctx); 
149:	spinner.setAdapter(getAdapter(ctx, 
-
151:	spinner.setLayoutParams(paramsW); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getOnItemSelectedListener
153:	assertTrue(mSpinner.getOnItemSelectedListener() != null); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: getContext, getSelectedItem
13:	if (spinner.getSelectedItem() == null) 
14:	mc.registerFieldError(spinner, getFormattedFeedbackMessageString(spinner.getContext())); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getId, setSelection, setAdapter
24:	spinner.setAdapter(adapter); 
-
29:	spinner.setSelection(savedSelection, false); 
-
34:	return "Spinner" + spinner.getId() + "Position"; 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: setAdapter
128:	serveropts.setAdapter(adapter); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: getSelectedItemPosition
118:	switch (mMenuMode.getSelectedItemPosition()) 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getSelectedItem
48:	String sel = spinner1.getSelectedItem().toString(); 
Full Snippet Info
6
CodeRank
Related Android Spinner Questions & Answers:
Other Android Spinner Examples
19:	        // Spinner element
20:	        Spinner spinner = (Spinner) findViewById(R.id.spinner);
21:	
22:	        // Spinner click listener
23:	        spinner.setOnItemSelectedListener(this);
-
19:	        // Spinner element
20:	        Spinner spinner = (Spinner) findViewById(R.id.spinner);
21:	
22:	        // Spinner click listener
23:	        spinner.setOnItemSelectedListener(this);

Read More

2:		private Button btnAddNewCategory;
3:		private TextView txtCategory;
4:		private Spinner spinnerFood;
5:		// array list for spinner adapter
6:		private ArrayList<Category> categoriesList;
-
19:	
20:			btnAddNewCategory = (Button) findViewById(R.id.btnAddNewCategory);
21:			spinnerFood = (Spinner) findViewById(R.id.spinFood);
22:			txtCategory = (TextView) findViewById(R.id.txtCategory);
23:

Read More

19:	
20:		// Spinner element
21:		Spinner spinner;
22:	
23:		// Add button
-
33:	
34:			// Spinner element
35:			spinner = (Spinner) findViewById(R.id.spinner);
36:	
37:			// add button

Read More

1:	Spinner spinner = (Spinner) findViewById(R.id.spinner);
2:	spinner.setOnItemSelectedListener(this);
3:	
-
1:	Spinner spinner = (Spinner) findViewById(R.id.spinner);
2:	spinner.setOnItemSelectedListener(this);
3:

Read More

1:	Spinner spinner = (Spinner) findViewById(R.id.spinner);
2:	// Create an ArrayAdapter using the string array and a default spinner layout
3:	ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this,
-
1:	Spinner spinner = (Spinner) findViewById(R.id.spinner);
2:	// Create an ArrayAdapter using the string array and a default spinner layout
3:	ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this,

Read More

See Code Examples for Android Spinner Methods: