{ "id": "78706", "key": "TIMOB-4877", "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": "2017-07-10T22:04:20.000+0000", "created": "2011-08-03T09:55:27.000+0000", "priority": { "name": "Trivial", "id": "5" }, "labels": [ "tbs-1.9.0" ], "versions": [ { "id": "11570", "description": "", "name": "Release 1.7.2", "archived": true, "released": true, "releaseDate": "2011-07-21" } ], "issuelinks": [], "assignee": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2017-07-10T22:04:29.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": "In the code below, you will never see the activity indicator if you do not use setTimeout\r\n\r\nStep 1: run the code below\r\nStep 2: notice that you do not see an activity indicator or the blue window\r\nStep 3: uncomment the setTimeout\r\nStep 4: run the app again\r\nStep 5: notice that the activity indicator and blue window show as expected.\r\n\r\n{code:title=\"app.js\"}\r\nvar win = Ti.UI.createWindow({\r\n\tbackgroundColor: 'blue'\r\n});\r\n\r\nvar actInd = Titanium.UI.createActivityIndicator({\r\n\tbottom:100, \r\n\theight:50,\r\n\twidth:10,\r\n\tstyle:Titanium.UI.iPhone.ActivityIndicatorStyle.PLAIN,\r\n\tfont: {fontFamily:'Helvetica Neue', fontSize:15,fontWeight:'bold'},\r\n\tcolor: 'white',\r\n\tmessage: 'Loading...',\r\n\twidth: 210\r\n});\r\n\r\nvar loadingWin = Ti.UI.createWindow({\r\n\t\tbackgroundImage: Ti.Platform.name == 'iPhone OS' ? 'Default.png':'default.png' ,\r\n\t\tfullscreen: true\r\n});\r\n\r\nloadingWin.open();\r\nloadingWin.add(actInd);\r\nactInd.show();\r\n\r\n// setTimeout(function(){\r\n\tfor(var i = 0; i<3000; i++){\r\n\t\tTi.API.info(i);\r\n\t}\r\n\tloadingWin.close();\r\n\tactInd.hide();\r\n\twin.open();\r\n// },0);\r\n{code}\r\n\r\nh3. Workaround\r\nUse setTimeout as shown in the example above.\r\n\r\nh3. Associated Helpdesk Ticket\r\nhttp://appc.me/c/APP-571741", "attachment": [], "flagged": false, "summary": "Android: activityIndicator does not show in app.js without setTimeout", "creator": { "name": "jalter", "key": "jalter", "displayName": "Jon Alter", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "jalter", "key": "jalter", "displayName": "Jon Alter", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "TiSDK 1.7.2\r\nAndroid Emulator 2.2", "comment": { "comments": [ { "id": "169329", "author": { "name": "ayeung", "key": "ayeung", "displayName": "Allen Yeung", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Not much we can do here since it's an issue with JS multithreading. I would use the workaround as you suggested with setTimeout() or add an event listener for the 'open' event like:\r\n\r\n{code}\r\nvar win = Ti.UI.createWindow({\r\n\tbackgroundColor: 'blue'\r\n});\r\n\r\nvar actInd = Titanium.UI.createActivityIndicator({\r\n\tbottom:100, \r\n\theight:50,\r\n\twidth:10,\r\n\tstyle:Titanium.UI.iPhone.ActivityIndicatorStyle.PLAIN,\r\n\tfont: {fontFamily:'Helvetica Neue', fontSize:15,fontWeight:'bold'},\r\n\tcolor: 'white',\r\n\tmessage: 'Loading...',\r\n\twidth: 210\r\n});\r\n\r\nvar loadingWin = Ti.UI.createWindow({\r\n\t\tbackgroundImage: Ti.Platform.name == 'iPhone OS' ? 'Default.png':'default.png' ,\r\n\t\tfullscreen: true\r\n});\r\n\r\nloadingWin.open();\r\nloadingWin.add(actInd);\r\n\r\nactInd.show();\r\n\r\nloadingWin.addEventListener('open', function () { \r\n\tfor(var i = 0; i<1000; i++){\r\n\t\tTi.API.info(i);\r\n\t}\r\n\r\n\tloadingWin.close();\r\n\tactInd.hide();\r\n\twin.open();\r\n});\r\n{code}", "updateAuthor": { "name": "ayeung", "key": "ayeung", "displayName": "Allen Yeung", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-10-14T15:28:54.000+0000", "updated": "2011-10-14T15:28:54.000+0000" }, { "id": "423818", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket due to time passed and lack of progress for a number of years. Please open a new ticket if there are any problems.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-07-10T22:04:21.000+0000", "updated": "2017-07-10T22:04:21.000+0000" } ], "maxResults": 3, "total": 3, "startAt": 0 } } }