On Fri, Jul 20, 2012 at 8:06 AM, Andrew <andrew.masl...@allegrowireless.com> wrote: > Yes, I agree that this probably is freezing UI. But there's a problem here: > this cannot be run on a spawned thread as OS may kill the process right > after this call returns, thus, again, killing the saving thread in the > middle!
First, it is rather unlikely that the OS will "kill the process right after this call returns". Second, if you are trying to do anything that takes a while in onSaveInstanceState(), you're doing it wrong. You should be triggering that work in other places (e.g., onPause(), on an explicit action bar item click), and using a background thread in those places as well. For example, onSaveInstanceState() has nothing to do with a persistent data model (e.g., database). Third, as you are discovering, Android may terminate your work *anyway* if you are taking a long time on the main application thread. -- 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 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