On Thu, Jul 19, 2012 at 3:53 PM, Andrew <[email protected]> wrote: > I'm experiencing an unexpected OS behaviour; mentioned at least on Android > 2.x, possible applicable to newer versions too. > > When OS calls onSaveInstanceState (for whatever reason) apparently > application may be killed while within this call if it is run for rather a > long time (several seconds). > > Is there a known time limit for this call to run inside application?
That is called on the main application thread. It should not run for more than a few milliseconds. Moreover, you should not need it to run longer than a few milliseconds -- you should be copying data out of widgets or data members and putting them in a Bundle. > Is this a proper behaviour in general? It is not mentioned in > documentation. Any time you take "several seconds" on the main application thread, you can get an ANR or other behavior. > Is this preventable? Take much less time in onSaveInstanceState(). -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy _The Busy Coder's Guide to Android Development_ Version 3.8 Available! -- 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

