You don't need to do this for most app. You can use onRetainNonConfigurationInstance<http://developer.android.com/reference/android/app/Activity.html#onRetainNonConfigurationInstance()> () to send your future self any amount of data you wish to preserve. Games are a bit different because they rarely need to rely on configuration specific resources, but they could easily handle it in a similar way (you can preserve your OpenGL context across rotations for instance.)
On Mon, Nov 7, 2011 at 8:37 PM, Tim Mensch <[email protected]> wrote: > On 11/7/2011 8:43 AM, JP wrote: > > One of the major design flaws (IMO) in the Android SDK is in the area > > of how device orientation changes are handled. When the orientation > > changes from portrait to landscape (and vice-versa), Android > > completely breaks down an app and restarts it. If an app holds > > substantial amounts of data... > > ...then it shouldn't allow Android to tear it down and restart it. There's > a flag you can set to prevent this (somewhat broken for serious apps) > behavior. It's not a completely broken idea (it's related to the > "crash-always" technique, if you've heard of it) but for a large number of > apps (say, almost any game) it is a rather unfriendly behavior. > > It means that you need to handle the orientation change yourself, which is > often easy for a game (e.g., do nothing). But it still seems like the right > general answer. > > Tim > > -- > You received this message because you are subscribed to the Google Groups > "Android Discuss" 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-discuss?hl=en. > -- Romain Guy Android framework engineer [email protected] -- You received this message because you are subscribed to the Google Groups "Android Discuss" 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-discuss?hl=en.
