On Tue, Dec 27, 2011 at 7:37 PM, havexz <bali.param...@gmail.com> wrote:
> So my question is this a bug?

Mildly surprising, but I personally would not qualify it as being a
bug. There are no rules stipulating how frequently onItemSelected()
will be called on a configuration change when the activities are being
destroyed and recreated.

> As this leads
> to lot of issues when I using Loaders or AsyncTask etc.

Then your app has other problems. The user is perfectly capable of
using their finger and changing the selection of a Spinner as many
times as the user wants.

If you are using fragments, make the fragment holding the Spinner be a
dynamic fragment (created via a FragmentTransaction) and use
setRetainInstance(true), and this will probably avoid any
onItemSelected() calls being made as part of a configuration change.

If you are not using fragments, use onSaveInstanceState() and/or
onRetainNonConfigurationInstance() to let the new activity know what
the old activity started in terms of background operations, so you can
not only detect the configuration change but also deal with its
repercussions.

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