On Thu, Apr 21, 2011 at 11:17 AM, Keith Wiley <[email protected]> wrote:
> 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.

Right. If an AdapterView is hidden, it is not querying the Adapter for
any rows/cells/whatever, and so you'll get null for getSelectedView().
This is a perfectly reasonable optimization, IMHO.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android 3.0 Programming Books: http://commonsware.com/books

-- 
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