[TIMOB-17084] Android: ActionBar: setNavigationMode() crashes the app
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Won't Fix |
Resolution Date | 2014-07-03T19:25:16.000+0000 |
Affected Version/s | Release 3.3.0 |
Fix Version/s | Release 3.4.0 |
Components | Android |
Labels | qe-3.3.0 |
Reporter | Paras Mishra |
Assignee | Sunila |
Created | 2014-06-06T12:21:44.000+0000 |
Updated | 2017-03-22T23:00:53.000+0000 |
Description
Android: ActionBar: setNavigationMode() crashes the app
This is regression.It works fine with 3.2.3.GA SDK
Steps to reproduce:
1. Run the app attached app TIMOB-13135.zip
2. Tap on button "open childWin(same activity)".
3. Tap on button "show the tabs".
Expected:
Tabs should be shown
Actual:
App crashes, logs are as follows
[WARN] : dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x41e88ba8)
[ERROR] : TiApplication: (main) [246940,246940] Sending event: exception on thread: main msg:java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState; Titanium 3.3.0,2014/06/05 15:06,708f5ce
[ERROR] : TiApplication: java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
[ERROR] : TiApplication: at android.support.v4.app.FragmentManagerImpl.checkStateLoss(FragmentManager.java:1354)
[ERROR] : TiApplication: at android.support.v4.app.FragmentManagerImpl.enqueueAction(FragmentManager.java:1372)
[ERROR] : TiApplication: at android.support.v4.app.BackStackRecord.commitInternal(BackStackRecord.java:595)
[ERROR] : TiApplication: at android.support.v4.app.BackStackRecord.commit(BackStackRecord.java:574)
[ERROR] : TiApplication: at android.support.v7.app.ActionBarImplICS.commitActiveTransaction(ActionBarImplICS.java:378)
[ERROR] : TiApplication: at android.support.v7.app.ActionBarImplICS$TabWrapper.onTabSelected(ActionBarImplICS.java:559)
[ERROR] : TiApplication: at com.android.internal.app.ActionBarImpl.selectTab(ActionBarImpl.java:577)
[ERROR] : TiApplication: at com.android.internal.app.ActionBarImpl.setSelectedNavigationItem(ActionBarImpl.java:363)
[ERROR] : TiApplication: at com.android.internal.app.ActionBarImpl.setNavigationMode(ActionBarImpl.java:1196)
[ERROR] : TiApplication: at android.support.v7.app.ActionBarImplICS.setNavigationMode(ActionBarImplICS.java:229)
[ERROR] : TiApplication: at android.support.v7.app.ActionBarImplJB.setNavigationMode(ActionBarImplJB.java:20)
[ERROR] : TiApplication: at org.appcelerator.titanium.proxy.ActionBarProxy.handlesetNavigationMode(ActionBarProxy.java:321)
[ERROR] : TiApplication: at org.appcelerator.titanium.proxy.ActionBarProxy.handleMessage(ActionBarProxy.java:352)
[ERROR] : TiApplication: at android.os.Handler.dispatchMessage(Handler.java:98)
[ERROR] : TiApplication: at android.os.Looper.loop(Looper.java:136)
[ERROR] : TiApplication: at android.app.ActivityThread.main(ActivityThread.java:5017)
[ERROR] : TiApplication: at java.lang.reflect.Method.invokeNative(Native Method)
[ERROR] : TiApplication: at java.lang.reflect.Method.invoke(Method.java:515)
[ERROR] : TiApplication: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
[ERROR] : TiApplication: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
[ERROR] : TiApplication: at dalvik.system.NativeStart.main(Native Method)
Attachments
File | Date | Size |
---|---|---|
TIMOB-13135.zip | 2014-06-06T12:21:45.000+0000 | 6669486 |
Here's the test case converted to native Titanium:
Some additional information: This error will occur with what we would in the past call a "heavyweight" window. In the past, heavyweight and lightweight windows could both be created - this was based on the specified options during window creation. A tiapp.xml setting was added: "ti.android.useLegacyWindow" which initially had a default of "true" which allows the use of either window type. The default for this setting was then set to "false", which means all windows would use the new architecture as described in TIMOB-13796. As of 3.3.0 this option is no longer available, and ALL projects will use the new architecture. Since this error occurs on what we used to call a "heavyweight" window, and this is now the only option, this issue will always occur with 3.3.0 or greater, but will depend on both the tiapp.xml setting and the method window creation in 3.2.3.
With heavyweight window, each window has it's own activity associated with it. When 'openChild' is called, a new activity is launched and the old activity is stopped by the Android OS. This will result in OS calling onSaveInstanceState on the previous activity before stopping the activity. When 'show the tabs' is clicked, it is trying to modify the state of the fragment which was already saved and stopped. Since activity is already stopped, modified state will be lost if the activity is destroyed and hence Android throws this exception. Changing the state in the same activity (setNavigationMode) works without any issue. I don't think this is a bug.
A simple workaround is to replace LW window with a view. You can do this by replacing the openChild() function in the above test case with:
What version of Release 3.4.0 is this bug fixed ?? I installed the following continuous build : FRI JUL 18, 2014 2:57:13 PM version: 3.4.0 git hash: 58198c641d77e17d156431666e80bae732b5c130 Still am getting the above error.
Closing ticket as "Won't Fix".