Honeycomb activity spontaneously restarts itself
I've got a开发者_Go百科 really odd problem which comes out when testing my app on the Honeycomb emulator. When the "tablet" is rotated to portrait, my main Activity
seems to just get stuck, and restarts itself over and over again. The stack trace below seems to give no indication of what is going on, and I haven't been able to pinpoint the restart when debugging either. The same thing doesn't occur on a Gingerbread phone, which uses the same portrait layout.
I do not own a Honeycomb device (yet) so I cannot see whether this is a quirk of the emulator or not.
08-02 21:28:02.137: INFO/ActivityManager(81): Starting: Intent { cmp=com.espian.formulae.pro/.Host (has extras) } from pid 419
08-02 21:28:02.193: WARN/WindowManager(81): Failure taking screenshot for (354x230) to layer 21010
08-02 21:28:04.136: INFO/ActivityManager(81): Starting: Intent { cmp=com.espian.formulae.pro/.Host (has extras) } from pid 419
08-02 21:28:04.209: WARN/WindowManager(81): Failure taking screenshot for (354x230) to layer 21015
08-02 21:28:04.230: WARN/ActivityManager(81): Launch timeout has expired, giving up wake lock!
08-02 21:28:06.127: DEBUG/dalvikvm(419): GC_CONCURRENT freed 105K, 3% free 7353K/7559K, paused 13ms+161ms
08-02 21:28:06.178: WARN/ActivityManager(81): Activity idle timeout for ActivityRecord{40841ae0 com.espian.formulae.pro/.Host}
08-02 21:28:06.517: INFO/ActivityManager(81): Starting: Intent { cmp=com.espian.formulae.pro/.Host (has extras) } from pid 419
08-02 21:28:06.567: WARN/WindowManager(81): Failure taking screenshot for (354x230) to layer 21020
08-02 21:28:08.447: INFO/ActivityManager(81): Starting: Intent { cmp=com.espian.formulae.pro/.Host (has extras) } from pid 419
Thanks in advance for your help
I have found the problem finally! I have a spinner in the ActionBar, and didn't realise the listener was activated when the activity is first created. In landscape this just added another menu to the multiview pane (which I have recently noticed was another bug), but in portrait fires a new activity every time the last one is created.
Have you tried adding
android:configChanges="keyboardHidden|orientation"
in manifest under the Actvity tag, and overriding
@Override
public void onConfigurationChanged(Configuration newConfig) {
// TODO Auto-generated method stub
super.onConfigurationChanged(newConfig);
}
the above method in the same Activity...
精彩评论