[ACCEPTED]-Spinner prompt not showing-spinner
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 :
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....
}
you should set style ---> style="@android:style/Widget.Spinner" works 1 for me. Hope it help.
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
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.