Re: [android-developers] onSaveInstanceState() killed by OS

2012-07-20 Thread TreKing
On Fri, Jul 20, 2012 at 4:07 PM, Justin Anderson wrote: > This method, or it's fancy new Fragments version, might be of interest to >> you: >> >> http://developer.android.com/reference/android/app/Activity.html#onRetainNonConfigurationInstance%28%29 >> > > I don't know... I can't see how there is

Re: [android-developers] onSaveInstanceState() killed by OS

2012-07-20 Thread Justin Anderson
> > This method, or it's fancy new Fragments version, might be of interest to > you: > > http://developer.android.com/reference/android/app/Activity.html#onRetainNonConfigurationInstance%28%29 > I don't know... I can't see how there is much value in a method that "you must not rely on it being cal

Re: [android-developers] onSaveInstanceState() killed by OS

2012-07-20 Thread TreKing
On Fri, Jul 20, 2012 at 7:06 AM, Andrew 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! This method,

Re: [android-developers] onSaveInstanceState() killed by OS

2012-07-20 Thread Justin Anderson
Nice catch... I never noticed that before. Thanks, Justin Anderson MagouyaWare Developer http://sites.google.com/site/magouyaware On Fri, Jul 20, 2012 at 9:07 AM, RichardC wrote: > And not even your UI: > > *" The default implementation takes care of most of the UI per-instance > state for you

Re: [android-developers] onSaveInstanceState() killed by OS

2012-07-20 Thread Streets Of Boston
Hi Andrew, The answers you got are correct. You should spend as little time in onSaveInstanceState (or any other onX callback method) as possible. Preferably a few milliseconds. I don't know what your app does, but it looks like you try to save user supplied information (either in a file o

Re: [android-developers] onSaveInstanceState() killed by OS

2012-07-20 Thread RichardC
And not even your UI: *" The default implementation takes care of most of the UI per-instance state for you by calling onSaveInstanceState() on each view in the hierarchy that has an id, and by saving the id o

Re: [android-developers] onSaveInstanceState() killed by OS

2012-07-20 Thread Justin Anderson
As Mark said earlier... The main purpose of onSaveInstanceState() is to save the current state of your UI so you can restore it when the activity comes back... That way the rotation appears seamless to the user. This would mean saving text in EditText objects, or the checked state of a CheckBox o

Re: [android-developers] onSaveInstanceState() killed by OS

2012-07-20 Thread Mark Murphy
On Fri, Jul 20, 2012 at 8:06 AM, Andrew 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 r

Re: [android-developers] onSaveInstanceState() killed by OS

2012-07-20 Thread Andrew
I'll try to find this out through experiments. 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! On Thursday, July 19

Re: [android-developers] onSaveInstanceState() killed by OS

2012-07-19 Thread Mark Murphy
On Thu, Jul 19, 2012 at 5:00 PM, Andrew wrote: > So, basically the limit is ANR limit, correct? That's my guess. It's a guess, though. And, bear in mind that the ANR limit is merely the limit where Android will take action to stop the bleeding. Your UI should be completely frozen during these "s

Re: [android-developers] onSaveInstanceState() killed by OS

2012-07-19 Thread Andrew
So, basically the limit is ANR limit, correct? AFAIK this is ~3 seconds. This makes sense then. Thanks Mark. On Thursday, July 19, 2012 4:43:59 PM UTC-4, Mark Murphy (a Commons Guy) wrote: > > On Thu, Jul 19, 2012 at 3:53 PM, Andrew wrote: > > I'm experiencing an unexpected OS behaviour; menti

Re: [android-developers] onSaveInstanceState() killed by OS

2012-07-19 Thread Mark Murphy
On Thu, Jul 19, 2012 at 3:53 PM, Andrew 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

[android-developers] onSaveInstanceState() killed by OS

2012-07-19 Thread Andrew
Hello, 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) appa