Spinner does not show selected value

how to get selected value from spinner in android example
spinner kotlin
spinner with textview in android
drop down textview android
spinner android
set spinner value android
how to set value in spinner dynamically in android
androidx spinner

I have implemented the spinner by populating the array list through database.I can get and show the array list in my spinner array adapter but if I select the item in spinner it does not shown in spinner?What I had mistake here?

Here is my code,

 Spinner spinner1 = (Spinner) findViewById(R.id.prospin);
     ArrayAdapter<String> adapter1 = new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item, providerlist);


I get the selected item string by using this,

Spinner provid = (Spinner)findViewById(R.id.prospin);
String provider =provid.getSelectedItem().toString();

Can anyone help me out pls!!!

This answer may be a little stupid but try it. It worked for me.

  1. Check the background color of your spinner!
  2. And if it`s white change it
  3. Enjoy it!

Android Spinner - drop down list, Android Spinner Example, Android Drop Down List, android studio spinner, android drop down menu, spinner in android, android custom spinner Selecting an item from spinner would display a toast message. In the default state, a spinner shows its currently selected value. It doesn't stop us in clicking the next button. Event though it may look big enough, if your Spinner is too small it may not be able to display the value, confirm this by hardcoding the Spinner width and height to something large. Using a custom spinner item layout may help if this is the problem.

I got same problem and solved by adding notifyDataSetChanged() after binding data in Spinner.

First of all I have bind adapter with Blank ArrayList then getting List of Items from Server and added to that List but forgot to notifyDataSetChanged() after updated List.

just add adapter.notifyDataSetChanged(); after updating list.

Hope it will helpful.

Spinner in android with default selected value as empty/null, This Video will teach you How to set first value (default value) in spinner as empty​. Means Duration: 9:45 Posted: May 10, 2018 Spinner displays neither the default nor selected item value. But drop-down menu items are show when selected.


Spinner displays neither the default nor selected item value. But drop-down menu items are show when selected.


Background and text color both being white!!!


Write a custom layout for a spiner item and use it instead of the default,android.R.layout.simple_spinner_item.

How to change spinner text size and text color?

Code(Less reliable):
your_spinner_instance.setOnItemSelectedListener(new Spinner.OnItemSelectedListener(){
    public void onItemSelected(AdapterView<?> parent, View view, int pos,
                               long id) {
        ((TextView) view).setTextColor(Color.RED);
    public void onNothingSelected(AdapterView<?> parent) {


Android needs some major update or maybe dart and flutter should take over...

Thanks Catluc

Spinners, In the default state, a spinner shows its currently selected value. You should usually do so in your XML layout with a <Spinner> element. Spinner control not showing the selected text. Android: setSelection having no effect on Spinner. These were the only relevant ones I found. I set the text color to black. Set the default value , both right after setAdapter in onCreate and in the onNothingSelected methods , still nothing. Included the "true" boolean in the setSelection function.

Use wrap_content for the height of Spinner.

Probably it does not have enough height to show text.

Spinner in Android doesn't show its selected…, I connect to the db, retrieve the data, and show them in the dropdown menu. But when I select an item in the spinner, it doesn't show in the "box". ArrayL… If cast the value returned by the resulset? (String) resulSet. I'm using Spinner in my Application, while resuming from another screen, it is displaying the first item in it, but the old item is selected. I'm using the following code, Any one please help me.

Well this also happens if the context is not properly given. I was using getApplicationContext() where as it needs getBaseContext().

Implement Spinner Example in Android App, In this tutorial, we will code an example Android app with a Spinner drop But you can try and change the value of isVisible to VISIBLE to see if it is there or not. view, int position, long id) { // do something upon option selection } @Override  I create spinner with adapter data from json. But why spinner not showing text and not show when selected value. Somebody can help me please. Spinner &lt;Spinner android:id="@+id/spinCity"

Setting selected item of Spinner by value rather than by position , Setting selected item of Spinner by value rather than by position Your name to display (optional):. Email me Yo how do I do it for a custom spinner instead? I don't have this section of the code as I have a custom adapter. Retrieve Spinner drop down list selected item value in android. Spinner is a type of drop down list menu and you can select your item by tapping on mobile screen.   OnItemSelectedListener() function is apply to get selected item value from spinner drop down list menu.

Android spinner (drop down list) example, In this tutorial, we show you how to do the following tasks : button, fire when user click on it, and it will display selected value of Spinner. To get the selected value of a spinner you can follow this example. Create a nested class that implements AdapterView.OnItemSelectedListener. This will provide a callback method that will notify your application when an item has been selected from the Spinner. Within "onItemSelected" method of that class, you can get the selected item:

How to get Spinner selected item text in Android, How to get Spinner selected item text in Android spinner_item.xml .show(); } @Override public void onNothingSelected(AdapterView<?>  Because spinners do not display possible values — only the current value is visible — they are often used instead of combo boxes or lists when the set of possible values is extremely large. However, spinners should only be used when the possible values and their sequence are obvious.

  • you made my day
  • haha this solved my issue :) but instead if you want to change the text color see here
  • superb! Works absolutely fine for me! Thanks :)
  • if I change the background color, my spinner disappears, how do I do this?
  • Lost 1 hour on this. spinner is showing in the emulator but not on my device. A matter of colors!
  • This answer is hard to understand and might be more helpful if you provided example code.
  • I don't think so because everything is understandable by reading line by line.
  • Can you please elaborate more Please answer this stackoverflow.com/questions/59451247/…
  • It doesnt ask to get value of selected item. It says selected item is not drawn on layout. I have the same problem and I couldnt find an answer. Only background of spinner is shown and when you select an item from dropdown list nothing happens.
  • This does not display the selected item in the spinner. It only shows a toast containing the text of the selected item. The spinner remains blank.
  • Could please add a more complete answer. The user might not know where to make the changes you've suggested and your sentence is constructed in a way that is not very easy to understand.