{ "id": "126991", "key": "TIMOB-16524", "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": "15422", "description": "Release 3.3.0", "name": "Release 3.3.0", "archived": false, "released": true, "releaseDate": "2014-07-16" } ], "resolution": { "id": "7", "description": "", "name": "Invalid" }, "resolutiondate": "2014-03-10T15:37:51.000+0000", "created": "2014-03-01T00:51:08.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "ipass1" ], "versions": [ { "id": "15856", "description": "Release 3.2.1", "name": "Release 3.2.1", "archived": false, "released": true, "releaseDate": "2014-02-10" } ], "issuelinks": [ { "id": "35491", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "106605", "key": "TIMOB-12848", "fields": { "summary": "Android: Using the camera on certain devices causes the app to crash", "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": "Critical", "id": "1" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "sunila", "key": "sunila", "displayName": "Sunila", "active": true, "timeZone": "Asia/Kolkata" }, "updated": "2017-03-28T23:54:31.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": "This is an issue that originated from the camera issue: TIMOB-12848\r\n\r\nTo reproduce:\r\n\r\n1. Run the code below\r\n2. Take a picture\r\n\r\n\r\n{code}\r\nvar win = Titanium.UI.createWindow();\r\nvar imageView = Ti.UI.createImageView({height: Ti.UI.FILL, width: Ti.UI.Fill});\r\nwin.add(imageView);\r\n Titanium.Media.showCamera({\r\n \r\n success:function(event)\r\n {\r\n Ti.API.info('#### Camera Success');\r\n var cropRect = event.cropRect;\r\n var image = event.media;\r\n Ti.API.info(image.length);\r\n var filename = Titanium.Filesystem.tempDirectory + \"/\"+ 'camera_photo' + new Date().getTime() + \".png\";\r\n Ti.API.info(filename);\r\n var f = Titanium.Filesystem.getFile(filename);\r\n Ti.API.info(f.nativePath);\r\n if (f.exists()) {\r\n Ti.API.info('The file exist , trying to delete it before using it :' + f.deleteFile());\r\n f = Titanium.Filesystem.getFile(filename);\r\n }\r\n f.write(image);\r\n alert('Camera Success! The file size is '+f.size+' bytes.\\n Now trying to assign it to an image on the screen (this may fail for hi res images)')\r\n imageView.image = f.nativePath;\r\n },\r\n cancel:function()\r\n \r\n {\r\n Ti.API.info('#### Camera Cancel');\r\n },\r\n error:function(error)\r\n {\r\n // create alert\r\n Ti.API.info('#### Camera Error');\r\n var a = Titanium.UI.createAlertDialog({title:'Camera'});\r\n \r\n // set message\r\n if (error.code == Titanium.Media.NO_CAMERA)\r\n {\r\n a.setMessage('Device does not have video recording capabilities');\r\n }\r\n else\r\n {\r\n a.setMessage('Unexpected error: ' + error.code);\r\n }\r\n \r\n // show alert\r\n a.show();\r\n },\r\n allowEditing:true\r\n });\r\nwin.open();\r\n{code}\r\n\r\nExpected result:\r\nThe alert dialog should show up.\r\n\r\nActual result:\r\nThe alert dialog shows up behind the window (if you hit back to close the window, the alert dialog shows up)", "attachment": [], "flagged": false, "summary": "Android: Alert dialog appears behind window", "creator": { "name": "ayeung", "key": "ayeung", "displayName": "Allen Yeung", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "ayeung", "key": "ayeung", "displayName": "Allen Yeung", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "296305", "author": { "name": "sunila", "key": "sunila", "displayName": "Sunila", "active": true, "timeZone": "Asia/Kolkata" }, "body": "I don't think this is a bug. Since the window is not yet opened when showCamera is called, the activity that is used to launch the camera activity is the root activity and the callback doesn't comeback until it is active (by pressing back). To use the window activity, try calling the showCamera in 'open' event handler of the window. Modified sample\r\n\r\nvar win = Titanium.UI.createWindow();\r\nvar imageView = Ti.UI.createImageView({height: Ti.UI.FILL, width: Ti.UI.Fill});\r\nwin.add(imageView);\r\n\t\r\nwin.addEventListener(\"open\", function(e){\r\n Titanium.Media.showCamera({\r\n \r\n success:function(event)\r\n {\r\n Ti.API.info('#### Camera Success');\r\n var cropRect = event.cropRect;\r\n var image = event.media;\r\n Ti.API.info(image.length);\r\n var filename = Titanium.Filesystem.tempDirectory + \"/\"+ 'camera_photo' + new Date().getTime() + \".png\";\r\n Ti.API.info(filename);\r\n var f = Titanium.Filesystem.getFile(filename);\r\n Ti.API.info(f.nativePath);\r\n if (f.exists()) {\r\n Ti.API.info('The file exist , trying to delete it before using it :' + f.deleteFile());\r\n f = Titanium.Filesystem.getFile(filename);\r\n }\r\n f.write(image);\r\n alert('Camera Success! The file size is '+f.size+' bytes.\\n Now trying to assign it to an image on the screen (this may fail for hi res images)')\r\n imageView.image = f.nativePath;\r\n },\r\n cancel:function()\r\n \r\n {\r\n Ti.API.info('#### Camera Cancel');\r\n },\r\n error:function(error)\r\n {\r\n // create alert\r\n Ti.API.info('#### Camera Error');\r\n var a = Titanium.UI.createAlertDialog({title:'Camera'});\r\n \r\n // set message\r\n if (error.code == Titanium.Media.NO_CAMERA)\r\n {\r\n a.setMessage('Device does not have video recording capabilities');\r\n }\r\n else\r\n {\r\n a.setMessage('Unexpected error: ' + error.code);\r\n }\r\n \r\n // show alert\r\n a.show();\r\n },\r\n allowEditing:true\r\n });\r\n});\r\nwin.open();", "updateAuthor": { "name": "sunila", "key": "sunila", "displayName": "Sunila", "active": true, "timeZone": "Asia/Kolkata" }, "created": "2014-03-10T15:37:51.000+0000", "updated": "2014-03-10T15:37:51.000+0000" }, { "id": "416097", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket as invalid.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-03-28T23:54:31.000+0000", "updated": "2017-03-28T23:54:31.000+0000" } ], "maxResults": 2, "total": 2, "startAt": 0 } } }