Spinner does not show selected value

Jolly picture Jolly · Dec 3, 2013 · Viewed 52.7k times · Source

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);

  adapter1.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner1.setAdapter(adapter1);

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!!!

Answer

Catluc picture Catluc · Apr 19, 2016

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!