[ACCEPTED]-Spinner prompt not showing-spinner

Accepted answer
Score: 12

Prompt is used to show title on dropdown 6 popup not for default text.

I think you are 5 looking for setting the default value on 4 spinner when you have not selected any value 3 from spinner dropdown. For that you need 2 to use NothingSelectedSpinnerAdapter, below 1 is the link for more details :

https://stackoverflow.com/a/12221309/2389804

Score: 6

Not the correct way but it works.. What 3 ever you wan to show give it as the first 2 item in the String array like this

string.xml

 <string-array name="Profession">
    <item>Please select the Profession</item>
    <item>Student</item>
    <item>Prof</item>
    <item>staff</item>
    <item>research student</item>

in 1 java code when ur reading from spinng object

Spinner profession = (Spinner)findViewById(R.id.profession);

String prof = String.valueOf(profession.getSelectedItem());


if(prof.equals("Please select the Profession"))
    {

      Toast.makeText(getApplicationContext(), "Please select the Profession", Toast.LENGTH_SHORT).show();

    }else{
   //Do your thing here....
    }
Score: 5

you should set style ---> style="@android:style/Widget.Spinner" works 1 for me. Hope it help.

Score: 1

I had the same problem and style="@android:style/Widget.Spinner" was the solution 2 for me as well. just insert into the Spinner 1 tag without the android: preface

More Related questions