On Tue, Dec 27, 2011 at 8:08 PM, havexz <bali.param...@gmail.com> wrote:
> I agree that user can call it multiple times even though program is
> processing last selection. But these un-necessary calls make the
> program looks sluggish, even though we are using all the goodies of
> background processing.

Which means you need to have appropriate smarts to deal with it.

> Well I should treat is as bug, because it is violating the api
> contract
>
> [http://developer.android.com/reference/android/widget/
> AdapterView.OnItemSelectedListener.html]
>
> by sending SAME values to the api which is suppose to be called when
> selection changes.

You are assuming that it is the same Spinner object and the same
OnItemSelectedListener. Instead, it is a completely different Spinner
instance and a completely different OnItemSelectedListener instance,
for a completely different fragment instance in a completely different
activity instance.

What I found surprising is that it is *not* being called twice for the
1st item. My guess is that this is a side-effect of the first item
being the default selection if you have not specified otherwise, but
that's a guess.

> To illustrate, if I select Earth twice, the log statement is called
> once, only for the first I change my selection to Earth from some
> other selection

Which, IMHO, is precisely what should happen when the activity is
destroyed and recreated and you use static fragments (or no fragments
at all), as you indicated that you are.

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

Android Training in NYC: http://marakana.com/training/android/

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