I have determined the discrepancy.  Your code calls getSelectedItem()
on the spinner.  Mine calls getSelectedTextView().  In your case, you
get a non-null response regardless of the visible status.  In mine, I
get a null if it is initially gone, but I get a TextView if it is
initially visible.  Furthermore, if I toggle the spinner's visibility
from gone to visible, I get a non-null response, AND if I toggle
twice, thus hiding the spinner again, I still get a nonnull response.

Here's my modification of your code that demonstrates this point:
http://www.keithwiley.com/Downloads/Spinner2.zip

If you exit immediately, it says the selected text view is null.  If
you toggle the button once to show the spinner and exit, it says the
text view is not null.  BUT, if you toggle it twice, showing and
hiding the text view, then exit, it STILL says the text view is not
null, so it needs to draw the spinner once and then it's good to go
even if the spinner is subsequently hidden.

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

Reply via email to