Re: [android-developers] Re: onSaveInstanceState(Bundle) onRestoreInstanceState(Bundle)

2011-04-17 Thread Streets Of Boston
mm... I need to check this really quickly. I thought that using onRetainNonConfigurationInstance and getLastNonConfigurationInstancehttp://reference/android/app/Activity.html#getLastNonConfigurationInstance() is enough to carry state from one configuration to the other (e.g. when

Re: [android-developers] Re: onSaveInstanceState(Bundle) onRestoreInstanceState(Bundle)

2011-04-17 Thread Kostya Vasilyev
It might be enough, depending on the activity in question, but they are somewhat different beasts. onSaveInstanceState / restore: Provides automatic persistence of view states (edit control contents, list view and scroll view positions, etc). The Bundle is retained by the framework and

Re: [android-developers] Re: onSaveInstanceState(Bundle) onRestoreInstanceState(Bundle)

2011-04-17 Thread Mark Murphy
On Sun, Apr 17, 2011 at 12:38 PM, Streets Of Boston flyingdutc...@gmail.com wrote: mm... I need to check this really quickly. I thought that using onRetainNonConfigurationInstance and getLastNonConfigurationInstanceĀ is enough to carry state from one configuration to the other (e.g.

Re: [android-developers] Re: onSaveInstanceState(Bundle) onRestoreInstanceState(Bundle)

2011-04-17 Thread Streets Of Boston
My app stores screen-data (limited sized data that is shown to the user and could possibly be modified by the user) in Parcelables. These are assigned to Intents when starting the activity. I return this Parcelable in the onRetainNonConfiguration instance and I assign it to the bundle in

Re: [android-developers] Re: onSaveInstanceState(Bundle) onRestoreInstanceState(Bundle)

2011-04-17 Thread Dianne Hackborn
The rules are: 1. onSaveInstanceState()/onCreate(Bundle) should always completely save and restore your activity's state so the new activity is in the same state as the old activity. 2. onRetainNonConfigurationInstance() is an *optional* thing you can use to *optimize* the case where the activity

Re: [android-developers] Re: onSaveInstanceState(Bundle) onRestoreInstanceState(Bundle)

2011-04-17 Thread Streets Of Boston
Thanks! I think i'm doing that, since I do handle the case in which getLastNonConfigurationInstance returns null. Last week I was looking into the LoaderManager. It would have made some of my app's data loading easier. But it is only for api-level 11 or up. Can't use it... -- You received

Re: [android-developers] Re: onSaveInstanceState(Bundle) onRestoreInstanceState(Bundle)

2011-04-17 Thread Dianne Hackborn
On Sun, Apr 17, 2011 at 11:53 AM, Streets Of Boston flyingdutc...@gmail.com wrote: Last week I was looking into the LoaderManager. It would have made some of my app's data loading easier. But it is only for api-level 11 or up. Can't use it... This is also part of the v4 support library with

[android-developers] Re: onSaveInstanceState(Bundle) onRestoreInstanceState(Bundle)

2011-04-16 Thread Streets Of Boston
For rotating the phone or sliding out the keyboard and such, onSaveInstanceState is not called and the onCreate will have a null value for the 'savedInstanceState' parameter. To handle this, use onRetainNonConfigurationInstance and

Re: [android-developers] Re: onSaveInstanceState(Bundle) onRestoreInstanceState(Bundle)

2011-04-16 Thread TreKing
On Sat, Apr 16, 2011 at 3:13 PM, Streets Of Boston flyingdutc...@gmail.comwrote: For rotating the phone or sliding out the keyboard and such, onSaveInstanceState is not called and the onCreate will have a null value for the 'savedInstanceState' parameter. Was that a typo? Rotating the phone

Re: [android-developers] Re: onSaveInstanceState(Bundle) onRestoreInstanceState(Bundle)

2011-04-16 Thread Dianne Hackborn
Yes any config change like that involving restarting an activity will save and restore its state like normal. Otherwise the new activity would not match the old one. On Sat, Apr 16, 2011 at 1:37 PM, TreKing treking...@gmail.com wrote: On Sat, Apr 16, 2011 at 3:13 PM, Streets Of Boston

[android-developers] Re: onSaveInstanceState(Bundle) onRestoreInstanceState(Bundle)

2011-04-15 Thread ravi teja
Presently, I am facing the same issue. How did you resolve it? Best, Ravi -- Raviteja http://about.me/raviteja -- 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

[android-developers] Re: onSaveInstanceState(Bundle) onRestoreInstanceState(Bundle)

2011-04-15 Thread Streets Of Boston
I don't understand this sentence which has a link to the original one. What does that mean in your code? Anyway, onRestoreInstanceState is only called when your Activity's process had been killed (maybe due to low memory) while your Activity was still in the back-stack. You can simulate this

[android-developers] Re: onSaveInstanceState(Bundle) onRestoreInstanceState(Bundle)

2011-04-15 Thread Sahil Verma
I've had this same problem too and actually posted to the mailing list a few weeks ago but got not responses: https://groups.google.com/d/topic/android-developers/6GfbdsJIj9k/discussion I was testing it on hardware by simply rotating the phone, changing the orientation and recreating the

[android-developers] Re: onSaveInstanceState(Bundle) onRestoreInstanceState(Bundle)

2011-04-15 Thread Sahil Verma
For sample code of what I was doing, you could take a look here: https://github.com/vermasque/song-alarm/blob/master/src/org/vermasque/songalarm/SongAlarmActivity.java -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group,