{ "id": "116158", "key": "TIMOB-14399", "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": "15695", "description": "2013 Sprint 20", "name": "2013 Sprint 20", "archived": true, "released": true, "releaseDate": "2013-10-04" }, { "id": "15696", "description": "2013 Sprint 20 API", "name": "2013 Sprint 20 API", "archived": true, "released": true, "releaseDate": "2013-10-04" }, { "id": "14982", "description": "Release 3.2.0", "name": "Release 3.2.0", "archived": false, "released": true, "releaseDate": "2013-12-19" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2013-09-30T19:44:39.000+0000", "created": "2013-06-19T08:21:53.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [ "android", "module_scrollableview", "qe-manualtest", "qe-testadded", "scrollableview", "webview" ], "versions": [], "issuelinks": [], "assignee": { "name": "sunila", "key": "sunila", "displayName": "Sunila", "active": true, "timeZone": "Asia/Kolkata" }, "updated": "2014-11-20T22:09:24.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": "*Steps to reproduce*\r\n1. Run the sample code\r\n2. Click on the button\r\n3. It opens a window which contains a webview with a blue background. The webview is inside a scrollableview.\r\n4. Upon opening you will see the webview being removed (strangely also the html content is still there …)\r\n\r\n*Test case*\r\n{code:javascript}\r\nvar win = Ti.UI.createWindow({\r\n\tbackgroundColor : 'white',\r\n\tfullscreen : false,\r\n\tnavBarHidden : true,\r\n\texitOnClose : true\r\n});\r\n\r\nvar html = \"Hello world\"\r\n\r\nvar button = Ti.UI.createButton({\r\n\ttitle : 'open',\r\n\tbottom : '30'\r\n});\r\nbutton.addEventListener('click', function() {\r\n\tvar win2 = Ti.UI.createWindow({\r\n\t\tbackgroundColor : 'yellow',\r\n\t\tfullscreen : false,\r\n\t\tnavBarHidden : true\r\n\t});\r\n\tvar webview2 = Ti.UI.createWebView({\r\n\t\tbackgroundColor : 'blue',\r\n\t\twidth : 100,\r\n\t\theight : 100,\r\n\t\thtml : html,\r\n\t\tshowScrollbars : false,\r\n\t\tscalesPageToFit : true,\r\n\t\tenableZoomControls : false,\r\n\t\ttouchEnabled : false\r\n\t});\r\n\twebview2.addEventListener('load', function() {\r\n\t\twebview2.evalJS('showMessage(\\\"Hello!2\\\");');\r\n\t})\r\n\tvar scrollableview = Ti.UI.createScrollableView({\r\n\t\tviews : [webview2]\r\n\t})\r\n\twin2.add(scrollableview);\r\n\twin2.open();\r\n\twin.close();\r\n});\r\nwin.add(button);\r\nwin.open();\r\n{code}\r\n\r\n*Solution*\r\nIt took me a day to find out what was happening. The reason is that the scrollableView does not call setActivity on its views.\r\nIt matters in this sample because i close the first window when opening the second one.\r\n\r\nSo this is what happens:\r\n- create win2\r\n- create webview : activity set to current activity = activity of win\r\n- open win2: setActivity called on the scrollableview but not its views\r\n- createView is called on the webview. there the WebviewProxy add a LifeCycleEvent on it s activity which is the one from win\r\n- close win: it s activity is destroyed WebviewProxy \r\n- onDestroy is wrongly called on the WebviewProxy\r\n\r\nWill add a PR\r\n\r\n", "attachment": [], "flagged": false, "summary": "Android: scrollableView does not set activity to its views", "creator": { "name": "farfromrefuge", "key": "farfromrefuge", "displayName": "Martin Guillon", "active": false, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "farfromrefuge", "key": "farfromrefuge", "displayName": "Martin Guillon", "active": false, "timeZone": "Europe/Berlin" }, "environment": "Titanium SDK 3.2.0 master\r\nandroid sdk 4.1\r\ndevice / simulator", "comment": { "comments": [ { "id": "258509", "author": { "name": "farfromrefuge", "key": "farfromrefuge", "displayName": "Martin Guillon", "active": false, "timeZone": "Europe/Berlin" }, "body": "Pull request https://github.com/appcelerator/titanium_mobile/pull/4402", "updateAuthor": { "name": "farfromrefuge", "key": "farfromrefuge", "displayName": "Martin Guillon", "active": false, "timeZone": "Europe/Berlin" }, "created": "2013-06-19T08:37:39.000+0000", "updated": "2013-06-19T08:37:39.000+0000" }, { "id": "259312", "author": { "name": "dsefton", "key": "dsefton", "displayName": "Daniel Sefton", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Could you clarify what you mean by \"Upon opening you will see the webview being removed (strangely also the html content is still there …)\" - I don't see any visual indication of this, the web view with the blue background is visible. Tested on Samsung Galaxy S2 2.3.6, Ti SDK 3.1.1 GA. Just need to be sure.", "updateAuthor": { "name": "dsefton", "key": "dsefton", "displayName": "Daniel Sefton", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-06-25T00:17:12.000+0000", "updated": "2013-06-25T00:17:12.000+0000" }, { "id": "259337", "author": { "name": "farfromrefuge", "key": "farfromrefuge", "displayName": "Martin Guillon", "active": false, "timeZone": "Europe/Berlin" }, "body": "@Daniel: look at the background colors. It should be blue (webview) and it will be yellow).\nAnd i dont know about 2.3.6. As mentioned in my bug request it s been tested on > 4.0\nBut seeing that it is an obvious bug you should see it too.", "updateAuthor": { "name": "farfromrefuge", "key": "farfromrefuge", "displayName": "Martin Guillon", "active": false, "timeZone": "Europe/Berlin" }, "created": "2013-06-25T08:25:06.000+0000", "updated": "2013-06-25T08:25:06.000+0000" }, { "id": "270587", "author": { "name": "sunila", "key": "sunila", "displayName": "Sunila", "active": true, "timeZone": "Asia/Kolkata" }, "body": "Additional changes as per the comment in the original pull request\r\n\r\nhttps://github.com/appcelerator/titanium_mobile/pull/4668", "updateAuthor": { "name": "sunila", "key": "sunila", "displayName": "Sunila", "active": true, "timeZone": "Asia/Kolkata" }, "created": "2013-09-10T17:12:47.000+0000", "updated": "2013-09-10T17:12:47.000+0000" }, { "id": "273432", "author": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "body": "PR https://github.com/appcelerator/titanium_mobile/pull/4728 merged. Resolving.", "updateAuthor": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2013-09-30T19:44:29.000+0000", "updated": "2013-09-30T19:44:29.000+0000" }, { "id": "276107", "author": { "name": "djha", "key": "djha", "displayName": "Dhirendra Jha", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Test Environment - \nAppc Studio - 3.2.0.201310181700\nSDK - 3.2.0.v20131021142445\nacs - 1.0.7\nalloy - 1.2.2\ntitanium - 3.2.0\ntitanium-code-processor - 1.0.3\nXcode - 5.0\nOS - Mountain Lion (10.8.5)\nDevices - Nexus 7(v4.2.1), Galaxy Note (v2.3.6)\n\nResult - Now its working fine. hence closing this issue.", "updateAuthor": { "name": "djha", "key": "djha", "displayName": "Dhirendra Jha", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-10-22T09:45:17.000+0000", "updated": "2013-10-22T09:45:17.000+0000" } ], "maxResults": 6, "total": 6, "startAt": 0 } } }