I would strongly suggest not handling configuration changes yourself. The default behavior for them is to restart your activity. Let that happen. Turning that off, then trying to replicate the behavior, is just not going to work.
If you have code separate from the activity that needs to do something when the configuration changes, it can explicitly register for the configuration change broadcast. On Sat, Nov 6, 2010 at 6:38 PM, Jiang <[email protected]> wrote: > 1, By default, if android system configuration is changed, only top > activity is restarted (onDestroy is invoked, then onCreate is invoked) > immediately, and other activities in history stack will defer to be > restarted once they are resumed. > > 2, I need to do extra works once configuration changed, so I capture > configuration changes event. and in onConfiguratonChanged, I restart > activity as following: > > finish(); > Intent intent = new Intent(this, getClass()); > startActivity(intent); > > The issues occur: > a), All activities in history stack will receive such event, so all > activities will be restart immediately, and activities stack is reordered > reversedly. > b), When restarted activity, onCreate is invoked before onDestroy() > > my question is: If I myself handle configuration changes event, how to > restart activity as Android does by default. > > Thanks very much! > - Jiang > > > > -- > 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]<android-developers%[email protected]> > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en -- Dianne Hackborn Android framework engineer [email protected] Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. -- 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

