[android-developers] Missing instance state when restoring dialogs

2010-12-02 Thread Olivier Guilyardi
Hi,

in my app, certain dialogs need some instance data when onPrepareDialog() is
called. I am saving this data in onSaveInstanceState() and restoring it in
onCreate(). This works fine according to my tests: I received the saved data in
the bundle passed to onCreate(), and then the dialogs get automatically restored
properly.

However, I get some crashes on the market console where it really seems like the
dialogs are being restored whereas onCreate() did not receive any saved state. I
have never reproduced that bug.

The console doesn't say which Android version that is, it only mentions Droid
and OTHER. Droid should be 2.1 or 2.2 I guess.

Any clue?

--
  Olivier

-- 
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


Re: [android-developers] Missing instance state when restoring dialogs

2010-12-02 Thread Frank Weiss
Use the onRestoreInstanceState() callback, not just onCreate().

-- 
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

Re: [android-developers] Missing instance state when restoring dialogs

2010-12-02 Thread Olivier Guilyardi
The onRestoreInstanceState() doc does not say that:
http://developer.android.com/intl/fr/reference/android/app/Activity.html#onRestoreInstanceState%28android.os.Bundle%29

From what I read, onCreate() is all what is needed. Implementing
onRestoreInstanceState() doesn't seem necessary in my case. IIUC correctly, if
there's any state to restore it is always passed to onCreate(), and before
onRestoreInstanceState() gets called.

Olivier

On 12/02/2010 08:44 PM, Frank Weiss wrote:
 Use the onRestoreInstanceState() callback, not just onCreate().
 
 -- 
 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

-- 
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