{ "id": "106688", "key": "TIMOB-12117", "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": "2013-03-03T15:17:42.000+0000", "created": "2012-12-18T12:35:01.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [ "community" ], "versions": [ { "id": "14613", "description": "Release 2.1.4", "name": "Release 2.1.4", "archived": true, "released": true, "releaseDate": "2012-11-12" }, { "id": "13505", "description": "Release 3.0.0", "name": "Release 3.0.0", "archived": true, "released": true, "releaseDate": "2012-12-14" } ], "issuelinks": [], "assignee": { "name": "sunila", "key": "sunila", "displayName": "Sunila", "active": true, "timeZone": "Asia/Kolkata" }, "updated": "2017-03-24T17:51:22.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": "h3. Problem descrption\r\nWhen trying to use activity.startActivityForResult on Android, if the window's property \"navBarHidden\" is set, the function argument of the method is not called.\r\n\r\nIn that case, there is no way to reach the intent's return.\r\n\r\nh3. Steps to reproduce\r\n- Run the sample code\r\n- Click on the Crop button to crop and save a picture in the gallery\r\nExpected result: lines 32 and 33 of the code should be triggered, but they are not.\r\nCommenting out 'navBarHidden' property of the window it works as expected.\r\n\r\n \r\n{code} \r\ncurWin = Ti.UI.createWindow({\r\n backgroundColor:'#ffffff',\r\n navBarHidden:true, // IF THIS IS ENABLED THE startActivityForResult WONT WORK\r\n exitOnClose:true\r\n});\r\n \r\nvar myView = Ti.UI.createView();\r\nvar curBtn = Ti.UI.createButton({\r\n color:'#000000',\r\n title:'Start Crop',\r\n height:'auto',\r\n width:'auto'\r\n});\r\nmyView.add(curBtn);\r\n\r\ncurBtn.addEventListener('click', function(e) {\r\n try{\r\n Titanium.Media.openPhotoGallery({\r\n success : function(event) {\r\n var intent = Ti.Android.createIntent({\r\n action: \"com.android.camera.action.CROP\", \r\n data: event.media.nativePath, \r\n type: 'image/*' \r\n });\r\n intent.putExtra(\"outputX\", 512);\r\n intent.putExtra(\"outputY\", 1024);\r\n intent.putExtra(\"aspectX\", 1);\r\n intent.putExtra(\"aspectY\", 2);\r\n intent.putExtra(\"scale\", true);\r\n var activity = Ti.Android.currentActivity; \r\n activity.startActivityForResult(intent, function(param){\r\n alert(JSON.stringify(param.intent));\r\n Ti.API.info('#### activity')\r\n }); \r\n },\r\n error:function(error)\r\n { },\r\n cancel : function()\r\n { }\r\n });\r\n }\r\n catch(e)\r\n { }\r\n}); \r\ncurWin.add(myView);\r\ncurWin.open();\r\n{code} \r\n", "attachment": [ { "id": "34237", "filename": "app.js", "author": { "name": "andreperazzi", "key": "andreperazzi", "displayName": "André Perazzi", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-12-18T12:35:01.000+0000", "size": 1333, "mimeType": "application/x-javascript" } ], "flagged": false, "summary": "Android: When navBarHidden of a window is set, activity.startActivityForResult won't work", "creator": { "name": "andreperazzi", "key": "andreperazzi", "displayName": "André Perazzi", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "fcasali", "key": "fcasali", "displayName": "Federico Casali", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "Android OS \r\nTiSDK tested 2.1.4 GA and 3.0 GA", "comment": { "comments": [ { "id": "231865", "author": { "name": "andreperazzi", "key": "andreperazzi", "displayName": "André Perazzi", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Are you able to see the alert?", "updateAuthor": { "name": "andreperazzi", "key": "andreperazzi", "displayName": "André Perazzi", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-12-18T16:50:35.000+0000", "updated": "2012-12-18T16:50:35.000+0000" }, { "id": "232128", "author": { "name": "andreperazzi", "key": "andreperazzi", "displayName": "André Perazzi", "active": true, "timeZone": "America/Los_Angeles" }, "updateAuthor": { "name": "andreperazzi", "key": "andreperazzi", "displayName": "André Perazzi", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-12-20T11:40:20.000+0000", "updated": "2012-12-20T11:41:06.000+0000" }, { "id": "240478", "author": { "name": "sunila", "key": "sunila", "displayName": "Sunila", "active": true, "timeZone": "Asia/Kolkata" }, "body": "setting the property 'navBarHidden' in createWindow will create a new Activity and js context. The code Ti.Android.currentActivity here, refers to the app main activity and the callback won't get called until that activity is active.\r\n To use the activity for the 'curWin', use 'curWin.getActivity()' instead of Ti.Android.currentActivity which will fix the problem", "updateAuthor": { "name": "sunila", "key": "sunila", "displayName": "Sunila", "active": true, "timeZone": "Asia/Kolkata" }, "created": "2013-03-03T15:17:42.000+0000", "updated": "2013-03-03T15:17:42.000+0000" }, { "id": "415582", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket as invalid with reference to the above comments.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-03-24T17:51:22.000+0000", "updated": "2017-03-24T17:51:22.000+0000" } ], "maxResults": 5, "total": 5, "startAt": 0 } } }