Hello,

When the android:windowIsTranslucent flag is set, instance state is
not saved properly when changing orientations if you have multiple
activities on the activity stack.

For example, given the following two activities:
ActivityTest & SecondActivity.

1) ActivityTest launches SecondActivity (SecondActivity is
translucent, such that you can still see ActivityTest.).
2) ActivityTest saves its instance state.
3) request orientation change. (i.e. ctrl+F12)
4) SecondActivity saves its instance state.
5) SecondActivity is recreated with saved instance state.
6) ActivityTest is recreated with saved instance state
7) SecondActivity is still on top.
8) request orientation change again.
9) SecondActivity saves its instance state.
10) SecondActivity is recreated with saved instance state.
11) ActivityTest is recreated with NULL instance state.

At this point, any instance state that was in ActivityTest is now
lost.  Its previous instance state should have been used in onCreate()
but NULL was passed in instead.

I have a test program that exhibits this behaviour and I can send it
on request.

I have pasted in the logcat output below.  The log has additional
entries describing the activity life cycle functions being called.

09-10 01:51:18.998: INFO/ActivityManager(49): Starting activity:
Intent { action=android.intent.action.MAIN flags=0x10200000
comp={gary.test/gary.test.ActivityTest} }
09-10 01:51:19.060: VERBOSE/ActivityTest(572): onCreate null
09-10 01:51:19.108: VERBOSE/ActivityTest(572): onResume
09-10 01:51:19.288: DEBUG/dalvikvm(49): GC freed 11049 objects /
576216 bytes in 151ms
09-10 01:51:21.428: WARN/KeyCharacterMap(572): No keyboard for id 0
09-10 01:51:21.428: WARN/KeyCharacterMap(572): Using default keymap: /
system/usr/keychars/qwerty.kcm.bin
09-10 01:51:22.139: INFO/ActivityManager(49): Starting activity:
Intent { comp={gary.test/gary.test.SecondActivity} }
09-10 01:51:22.160: VERBOSE/ActivityTest(572): onSaveInstanceState
09-10 01:51:22.168: VERBOSE/ActivityTest(572): onPause
09-10 01:51:22.198: VERBOSE/SecondActivity(572): onCreate null
09-10 01:51:22.209: VERBOSE/SecondActivity(572): onResume
09-10 01:51:23.615: INFO/WindowManager(49): Input configuration
changed: { scale=1.0 imsi=0/0 locale=en_US touch=3 key=2/1 nav=3
orien=2 }
09-10 01:51:23.719: VERBOSE/SecondActivity(572): onSaveInstanceState
09-10 01:51:23.719: VERBOSE/SecondActivity(572): onPause
09-10 01:51:23.719: VERBOSE/SecondActivity(572): onDestroy
09-10 01:51:23.742: INFO/ActivityManager(49): Displayed activity
gary.test/.ActivityTest: 4738 ms
09-10 01:51:23.909: VERBOSE/SecondActivity(572): onCreate
Bundle[{android:viewHierarchyState=Bundle[{android:[EMAIL PROTECTED],
android:[EMAIL PROTECTED]
09-10 01:51:23.909: VERBOSE/SecondActivity(572): onResume
09-10 01:51:24.089: VERBOSE/ActivityTest(572): onDestroy
09-10 01:51:24.111: VERBOSE/ActivityTest(572): onCreate
Bundle[{android:viewHierarchyState=Bundle[{android:[EMAIL PROTECTED],
android:focusedViewId=2131099648}]}]
09-10 01:51:24.139: INFO/ActivityManager(49): Displayed activity
gary.test/.SecondActivity: 1992 ms
09-10 01:51:24.219: VERBOSE/ActivityTest(572): onResume
09-10 01:51:24.230: VERBOSE/ActivityTest(572): onPause
09-10 01:51:24.659: DEBUG/SurfaceFlinger(49): Screen was frozen for
1049562 us
09-10 01:51:26.689: DEBUG/dalvikvm(49): GC freed 3451 objects / 141760
bytes in 79ms
09-10 01:51:27.658: INFO/WindowManager(49): Input configuration
changed: { scale=1.0 imsi=0/0 locale=en_US touch=3 key=2/2 nav=3
orien=1 }
09-10 01:51:27.739: VERBOSE/SecondActivity(572): onSaveInstanceState
09-10 01:51:27.739: VERBOSE/SecondActivity(572): onPause
09-10 01:51:27.739: VERBOSE/SecondActivity(572): onDestroy
09-10 01:51:27.879: VERBOSE/SecondActivity(572): onCreate
Bundle[{android:viewHierarchyState=Bundle[{android:[EMAIL PROTECTED],
android:[EMAIL PROTECTED]
09-10 01:51:27.889: VERBOSE/SecondActivity(572): onResume
09-10 01:51:28.198: VERBOSE/ActivityTest(572): onDestroy
09-10 01:51:28.209: VERBOSE/ActivityTest(572): onCreate null
09-10 01:51:28.298: VERBOSE/ActivityTest(572): onResume
09-10 01:51:28.298: VERBOSE/ActivityTest(572): onPause

--~--~---------~--~----~------------~-------~--~----~
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
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to