{ "id": "136700", "key": "TIMOB-17715", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [], "resolution": { "id": "7", "description": "", "name": "Invalid" }, "resolutiondate": "2014-09-18T17:39:31.000+0000", "created": "2014-09-17T02:17:18.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "android", "regression" ], "versions": [], "issuelinks": [], "assignee": { "name": "pwang", "key": "pwang", "displayName": "Ping Wang", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2017-03-22T21:51:21.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10202", "name": "Android", "description": "Android Platform" } ], "description": "After closing the last window on Android, when attempting to open a new window, the app crashes with the \"Unfortunately app has stopped\" message. Here is the stack trace that I get:\r\n{noformat}\r\nE/AndroidRuntime( 2450): FATAL EXCEPTION: main\r\nE/AndroidRuntime( 2450): Process: com.appdev.test, PID: 2450\r\nE/AndroidRuntime( 2450): java.lang.NullPointerException\r\nE/AndroidRuntime( 2450): \tat android.content.ComponentName.(ComponentName.java:77)\r\nE/AndroidRuntime( 2450): \tat android.content.Intent.(Intent.java:3813)\r\nE/AndroidRuntime( 2450): \tat ti.modules.titanium.ui.WindowProxy.handleOpen(WindowProxy.java:128)\r\nE/AndroidRuntime( 2450): \tat org.appcelerator.titanium.proxy.TiWindowProxy.handleMessage(TiWindowProxy.java:88)\r\nE/AndroidRuntime( 2450): \tat ti.modules.titanium.ui.WindowProxy.handleMessage(WindowProxy.java:399)\r\nE/AndroidRuntime( 2450): \tat android.os.Handler.dispatchMessage(Handler.java:98)\r\nE/AndroidRuntime( 2450): \tat android.os.Looper.loop(Looper.java:136)\r\nE/AndroidRuntime( 2450): \tat android.app.ActivityThread.main(ActivityThread.java:5017)\r\nE/AndroidRuntime( 2450): \tat java.lang.reflect.Method.invokeNative(Native Method)\r\nE/AndroidRuntime( 2450): \tat java.lang.reflect.Method.invoke(Method.java:515)\r\nE/AndroidRuntime( 2450): \tat com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)\r\nE/AndroidRuntime( 2450): \tat com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)\r\nE/AndroidRuntime( 2450): \tat dalvik.system.NativeStart.main(Native Method)\r\n{noformat}\r\n\r\nHere is the test case that I am using:\r\n{code:javascript}\r\nvar openWindow = function(index) {\r\n var window = Ti.UI.createWindow({\r\n backgroundColor: 'white',\r\n title: 'Window ' + index\r\n });\r\n var button = Ti.UI.createButton({\r\n width: 80,\r\n height: 40,\r\n title: 'Button'\r\n });\r\n button.addEventListener('click', function() {\r\n window.close();\r\n openWindow(index + 1);\r\n });\r\n window.add(button);\r\n window.open();\r\n};\r\nopenWindow(1);\r\n{code}\r\n\r\nIt successfully closes the first window but crashes when attempting to open the second window. It works when opening the second window before closing the first.", "attachment": [], "flagged": false, "summary": "Android: Cannot open new window after last window closes", "creator": { "name": "calebcox314", "key": "calebcox314", "displayName": "Caleb Cox", "active": true, "timeZone": "America/Chicago" }, "subtasks": [], "reporter": { "name": "calebcox314", "key": "calebcox314", "displayName": "Caleb Cox", "active": true, "timeZone": "America/Chicago" }, "environment": "Mac OS X 10.9.4\r\nTitanium SDK 3.3.0\r\nGoogle Nexus 4 Genymotion emulator running Android version 4.4.2 (api 19)", "closedSprints": [ { "id": 219, "state": "closed", "name": "2014 Sprint 19 SDK", "startDate": "2014-09-18T21:06:27.559Z", "endDate": "2014-09-27T00:00:00.000Z", "completeDate": "2014-09-29T13:58:58.022Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "324209", "author": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "body": "May I ask what classifies this as a regression? Did it previously work in an earlier version of the SDK?", "updateAuthor": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-09-17T09:34:49.000+0000", "updated": "2014-09-17T09:34:49.000+0000" }, { "id": "324240", "author": { "name": "calebcox314", "key": "calebcox314", "displayName": "Caleb Cox", "active": true, "timeZone": "America/Chicago" }, "body": "Yes, the exact same code runs without crashing using Titanium SDK 3.2.3. Sorry for not explicitly mentioning that earlier.", "updateAuthor": { "name": "calebcox314", "key": "calebcox314", "displayName": "Caleb Cox", "active": true, "timeZone": "America/Chicago" }, "created": "2014-09-17T15:31:53.000+0000", "updated": "2014-09-17T15:31:53.000+0000" }, { "id": "324274", "author": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~pwang] can you please take a look?", "updateAuthor": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-09-17T17:16:05.000+0000", "updated": "2014-09-17T17:16:05.000+0000" }, { "id": "324340", "author": { "name": "pwang", "key": "pwang", "displayName": "Ping Wang", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Starting from 3.3.0, we set exitOnClose to true by default for the first window (see [PR#5602|https://github.com/appcelerator/titanium_mobile/pull/5602]), which means once the first window is closed the whole application is closed. That's why the app crashes when you open the second window.\r\n\r\nTo make the above test case run, we can modify it\r\n{code}\r\nvar openWindow = function(index) {\r\n var window = Ti.UI.createWindow({\r\n backgroundColor: 'white',\r\n title: 'Window ' + index,\r\n exitOnClose: false //Override the default behavior\r\n });\r\n var button = Ti.UI.createButton({\r\n width: 80,\r\n height: 40,\r\n title: 'Button'\r\n });\r\n button.addEventListener('click', function() {\r\n window.close();\r\n openWindow(index + 1);\r\n });\r\n window.add(button);\r\n window.open();\r\n};\r\nopenWindow(1);\r\n{code}", "updateAuthor": { "name": "pwang", "key": "pwang", "displayName": "Ping Wang", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-09-17T20:18:39.000+0000", "updated": "2014-09-17T20:18:39.000+0000" }, { "id": "324342", "author": { "name": "calebcox314", "key": "calebcox314", "displayName": "Caleb Cox", "active": true, "timeZone": "America/Chicago" }, "body": "I verified that the change you suggested fixes my issue. Thanks for your help! Someone should update the documentation to reflect the new default value of exitOnClose.", "updateAuthor": { "name": "calebcox314", "key": "calebcox314", "displayName": "Caleb Cox", "active": true, "timeZone": "America/Chicago" }, "created": "2014-09-17T20:26:47.000+0000", "updated": "2014-09-17T20:26:47.000+0000" }, { "id": "324527", "author": { "name": "pwang", "key": "pwang", "displayName": "Ping Wang", "active": true, "timeZone": "America/Los_Angeles" }, "body": "This change has been in the 3.3.0 Release Notes. Will update the default value of exitOnClose.\r\nPR: https://github.com/appcelerator/titanium_mobile/pull/6127\r\n3_4_X PR: https://github.com/appcelerator/titanium_mobile/pull/6128\r\nResolved the ticket as invalid.", "updateAuthor": { "name": "pwang", "key": "pwang", "displayName": "Ping Wang", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-09-18T17:39:16.000+0000", "updated": "2014-09-18T18:29:50.000+0000" }, { "id": "326718", "author": { "name": "mokesmokes", "key": "mokesmokes", "displayName": "Mark Mokryn", "active": true, "timeZone": "Asia/Jerusalem" }, "updateAuthor": { "name": "mokesmokes", "key": "mokesmokes", "displayName": "Mark Mokryn", "active": true, "timeZone": "Asia/Jerusalem" }, "created": "2014-10-02T07:18:58.000+0000", "updated": "2014-10-02T07:18:58.000+0000" }, { "id": "415050", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket as invalid with reference to previous comments.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-03-22T21:51:21.000+0000", "updated": "2017-03-22T21:51:21.000+0000" } ], "maxResults": 8, "total": 8, "startAt": 0 } } }