I'm using Spinner to select a value from the drop down menu. I want initially to be displayed as "Please Select", after selecting a value it should disappear. I'm using the following code,
UPanelID = (Spinner) findViewById(R.id.spinner1);
ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item, data);
dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
UPanelID.setAdapter(dataAdapter);
UPanelID.setOnItemSelectedListener(typeSelectedListener);
data is a String array
You can do this by setting android:prompt="Please Select" attribute in Spinner in your xml file.
Or, you can see following example for making the first item in the Spinner "Please Select":
http://b2creativedesigns.comuv.com/Spinner.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With