{ "id": "103533", "key": "TIMOB-11517", "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": [ { "id": "14162", "description": "Release 3.1.0", "name": "Release 3.1.0", "archived": true, "released": true, "releaseDate": "2013-04-16" }, { "id": "14165", "description": "2012 Sprint 21 API", "name": "2012 Sprint 21 API", "archived": true, "released": true, "releaseDate": "2012-10-22" }, { "id": "14273", "description": "2012 Sprint 21", "name": "2012 Sprint 21", "archived": true, "released": true, "releaseDate": "2012-10-22" } ], "resolution": { "id": "3", "description": "The problem is a duplicate of an existing issue.", "name": "Duplicate" }, "resolutiondate": "2012-10-18T00:59:47.000+0000", "created": "2012-10-17T07:40:00.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "qe-and100112", "qe-testadded", "regression" ], "versions": [ { "id": "13505", "description": "Release 3.0.0", "name": "Release 3.0.0", "archived": true, "released": true, "releaseDate": "2012-12-14" } ], "issuelinks": [ { "id": "22088", "type": { "id": "10002", "name": "Duplicate", "inward": "is duplicated by", "outward": "duplicates" }, "outwardIssue": { "id": "102703", "key": "TIMOB-11264", "fields": { "summary": "Android: Event \"closeFromActivity\" cannot be fired on Android", "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" } }, "priority": { "name": "High", "id": "2" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "hpham", "key": "hpham", "displayName": "Hieu Pham", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2013-10-07T07:07:41.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": "On clicking the back button of device on third window,application closes instead of going to the previous window.\r\n\r\nThis is regression.This works fine on 2.1.3.GA.\r\n\r\nSteps to reproduce:\r\n\r\n1. Install and Launch app \r\n2. Press \"open red win\" (See result) \r\n3. Press \"open yellow win\" (see result) \r\n4. Press the Android back button (see result).\r\n\r\nExpected Result:\r\nAfter Step #2: A \"red\" (pinkish) window opens with a \"open yellow win\" button \r\nAfter Step #3: A \"yellow\" window opens with a \"close red win\" and a \"go home\" button \r\nAfter step #4 You should return to the red window \r\n\r\nActual result:\r\nAfter Step #2: A \"red\" (pinkish) window opens with a \"open yellow win\" button \r\nAfter Step #3: A \"yellow\" window opens with a \"close red win\" and a \"go home\" button \r\nAfter step #4: Application closes and returns to the menu screen of the device\r\n\r\n\r\napp.js\r\n\r\n{code}\r\nTitanium.UI.setBackgroundColor('#000');\r\n\r\ngt = { ui:{} };\r\n\r\ngt.ui.createNavigationGroup = function(options) \r\n{\r\n\tvar navGroup = \r\n\t{\r\n \tstack: [],\r\n window: options.window,\r\n to_root:options.to_root || false\r\n };\r\n\r\n navGroup.open = function(win, options) \r\n {\r\n Ti.API.info('pre open stack length: ' + navGroup.stack.length);\r\n \r\n if (navGroup.stack.length == 0) \r\n {\r\n navGroup.window.addEventListener('android:back', navGroup.go_back);\r\n Ti.API.info('addEventListener android:back');\r\n }\r\n\r\n navGroup.stack.push(win);\r\n win.open(options);\r\n Ti.API.info('after open stack length: ' + navGroup.stack.length);\r\n };\r\n\r\n navGroup.close = function(win, options) \r\n {\r\n var idx = navGroup.stack.indexOf(win);\r\n Ti.API.info('idx: ' + idx);\r\n if (idx != -1) navGroup.stack.splice(idx, 1);\r\n win.close(options);\r\n win = null;\r\n };\r\n\r\n navGroup.go_back = function(options) \r\n {\r\n var win = navGroup.stack.pop();\r\n if (win) \r\n {\r\n win.close(options);\r\n win = null;\r\n }\r\n\r\n if (navGroup.stack.length == 0) \r\n {\r\n Ti.API.info('removeEventListener android:back');\r\n navGroup.window.removeEventListener('android:back', navGroup.go_back);\r\n Ti.API.info('navGroup window close'); \r\n }\r\n\r\n };\r\n\r\n navGroup.go_home = function() \r\n {\r\n while (navGroup.stack.length) \r\n {\r\n navGroup.go_back();\r\n }\r\n };\r\n\r\n return navGroup;\r\n\r\n}\r\n\r\nvar tabGroup = Titanium.UI.createTabGroup();\r\n\r\nvar navWindow = Ti.UI.createWindow(\r\n{\r\n backgroundColor:'#ccc',\r\n navBarHidden:false\r\n});\r\n\r\n\r\nvar tabWindow = Ti.UI.createWindow(\r\n{\r\n backgroundColor:'#ccc'\r\n});\r\n\r\ntabWindow.addEventListener('click', function()\r\n{\r\n navTab.open(navWindow);\r\n});\r\n\r\n\r\nvar navBtn = Ti.UI.createButton(\r\n{\r\n title:'open red win',\r\n color:'#f00',\r\n width:200,\r\n height:40\r\n});\r\n\r\nnavWindow.add(navBtn);\r\n\r\n\r\nvar nav = gt.ui.createNavigationGroup(\r\n{\r\n window:navWindow\r\n});\r\n\r\n\r\nnavBtn.addEventListener('click', function()\r\n{\r\n var win = Ti.UI.createWindow(\r\n {\r\n backgroundColor:'#fcc'\r\n });\r\n\r\n\r\n var navBtn2 = Ti.UI.createButton(\r\n {\r\n title:'open yellow win',\r\n color:'#ff0',\r\n width:200,\r\n height:40\r\n });\r\n\r\n\r\n win.add(navBtn2);\r\n\r\n navBtn2.addEventListener('click', function()\r\n {\r\n var win2 = Ti.UI.createWindow(\r\n {\r\n backgroundColor:'#ffc'\r\n });\r\n\r\n\r\n var navBtn3 = Ti.UI.createButton(\r\n {\r\n title:'close red win',\r\n color:'#000',\r\n width:200,\r\n height:40,\r\n top:50\r\n });\r\n\r\n\r\n navBtn3.addEventListener('click', function()\r\n {\r\n nav.close(win);\r\n });\r\n\r\n win2.add(navBtn3);\r\n\r\n\r\n var navBtn4 = Ti.UI.createButton(\r\n {\r\n title:'go home',\r\n color:'#0f0',\r\n width:200,\r\n height:40,\r\n top:150\r\n });\r\n\r\n\r\n navBtn4.addEventListener('click', function()\r\n {\r\n nav.go_home(win);\r\n });\r\n\r\n win2.add(navBtn4);\r\n\r\n nav.open(win2);\r\n })\r\n\r\n\r\n nav.open(win);\r\n})\r\n\r\n\r\nvar navTab = Ti.UI.createTab(\r\n{\r\n id: 'navTab',\r\n title:'navGroup',\r\n window:navWindow\r\n});\r\n\r\ntabGroup.addTab(navTab);\r\n\r\ntabGroup.open();\r\n{code}\r\n \r\n", "attachment": [], "flagged": false, "summary": "Android: On clicking the back button of device on third window, application closes instead of going to the previous window", "creator": { "name": "nchhabra", "key": "nchhabra", "displayName": "Neha Chhabra", "active": true, "timeZone": "Asia/Kolkata" }, "subtasks": [], "reporter": { "name": "nchhabra", "key": "nchhabra", "displayName": "Neha Chhabra", "active": true, "timeZone": "Asia/Kolkata" }, "environment": "Tested with Titanium Studio: 3.0.0.201210101947\r\nTested with Titanium SDK: 3.0.0.v20121015174610\r\nAndroid Device: Galaxy Nexus 7(4.1)\r\nOS: Mac OSX 10.8.1", "comment": { "comments": [ { "id": "224000", "author": { "name": "hpham", "key": "hpham", "displayName": "Hieu Pham", "active": true, "timeZone": "America/Los_Angeles" }, "body": "master PR: https://github.com/appcelerator/titanium_mobile/pull/3237", "updateAuthor": { "name": "hpham", "key": "hpham", "displayName": "Hieu Pham", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-10-17T18:05:14.000+0000", "updated": "2012-10-17T18:05:14.000+0000" }, { "id": "224309", "author": { "name": "tsmolich", "key": "tsmolich", "displayName": "Tamila Smolich", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Closing as a duplicate of TIMOB-11264.", "updateAuthor": { "name": "tsmolich", "key": "tsmolich", "displayName": "Tamila Smolich", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-10-18T21:45:55.000+0000", "updated": "2012-10-18T21:45:55.000+0000" } ], "maxResults": 2, "total": 2, "startAt": 0 } } }