On Mon, Feb 14, 2011 at 5:24 PM, Kevin Duffey <[email protected]> wrote: > Oh.. so if you implement that onConfigurationChage, then orientation changes > (among other things) don't stop/restart activities?
Not exactly. You need the android:configChanges attribute in the manifest. > You'd think that would be emphasized more.. or is there some reason it > is not done as often? Yes. The fear is that you'll screw it up. If you use android:configChanges, for those configuration changes listed, Android does *nothing* other than call onConfigurationChanged(). It won't load in a fresh layout or otherwise update the UI to work on this configuration -- you have to do that. It won't load in fresh string resources for changes in locale (which is a configuration change) -- you have to do that. And so on. At the point in time you make the decision to use android:configChanges, it may seem like a fair deal. However: -- If you're not going to handle *all* configuration changes in android:configChanges, then you *still* have to do all the normal stuff for the destroy/recreate cycle, to handle the other configuration changes you skip (e.g., dock/undock). -- Every time you add a new resource, or possibly even change an existing one (e.g., layout), you will need to go through your code and make sure that you are handling it properly in onConfigurationChanged() or other places downstream. The belief is that you modify these things way more frequently than you modify stuff that would have to go into onSaveInstanceState() or onRetainNonConfigurationInstance(). Google's recommendation -- which I've come to agree with -- is that you use android:configChanges only in places where there is no way to deal with the destroy/recreate cycle (e.g., WebView, camera preview, streaming media playback, some games). -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Warescription: Three Android Books, Plus Updates, One Low Price! -- 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

