I have a Spinner whose items comes from an ArrayAdaper, and I want the
Spinner to initially show that no item has been selected. When the
user clicks on the Spinner it's DropDownView should display just those
items available for selection.

I don't want to add an empty/blank item at the head of my list of
items because that means that it shows as an  avalaible selection in
the DropDownView and looks pretty lame. And if a selection is made I
want it to be a valid
one.

I tried
  spinner#setSelection(-1);
but that doesn't work. The first item remains selected.

I tried setting no Adapter initially (which provides the desired
initial view) and had hoped to configure the appropriate adapter in
the OnClickListener, but spinner#setOnClickListener throw a
RuntimeException saying "You probably want to use
#setOnItemClickListener instead". And trying to use
#setOnItemClickListener throws a RuntimeException saying it is not
valid for a Spinner.


Surely this is a common use case.
How can I set the Spinner to initially show as empty?

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to