{ "id": "61888", "key": "TIMOB-1256", "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": "11225", "name": "Release 1.5.0", "archived": true, "released": true, "releaseDate": "2010-12-14" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2011-04-17T01:55:40.000+0000", "created": "2011-04-15T02:47:53.000+0000", "priority": { "name": "Trivial", "id": "5" }, "labels": [ "android", "defect" ], "versions": [], "issuelinks": [], "assignee": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2011-04-17T01:55:40.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": "{html}
It could be that this is sensitive to a different context than\nthe one which created the Titanium.Media singleton (maybe not\nrelated to that, but it's my guess.) Simple test: two JS's,\nstarting with app.js:
\n\nTitanium.UI.setBackgroundColor('#000');\nvar main = Titanium.UI.createWindow({ \n backgroundColor:'#fff',\n fullscreen: true\n});\n\nvar btn = Ti.UI.createButton({\n title: 'Open test window'\n});\n\nbtn.addEventListener('click', function(e) {\n var w = Ti.UI.createWindow({\n url: 'win1.js', \n backgroundColor: 'black', \n fullscreen:true\n });\n w.open();\n});\n\nmain.add(btn);\nmain.open();
\n
\nAnd win1.js:
\n\n\nvar win = Ti.UI.currentWindow; \nTi.Media.openPhotoGallery({\n success: function() {Ti.API.info('success');},\n cancel: function() {Ti.API.info('cancel');},\n error: function() {Ti.API.info('error');}\n});\n\nvar btn = Ti.UI.createButton({ title: 'close' });\nbtn.addEventListener('click', function() {win.close();});\nwin.add(btn);
\n
\nFirst time you go to the photo gallery, the callbacks will work.\nNext time not.
Behavior can also be seen in Phone -> Photo Gallery test in\nKS.
FYI, when the @ContextSpecific annotation (which I haven't\npushed yet) is applied to MediaModule, and therefore the module\n\"singleton\" is at the context rather than application level, it\nworks correctly.
I need this feature for a client, Is there a way to get this\nchange you made?
I rebuilt the code using Bill's fix and it seems to work\nfine.
\n@ContextSpecific public class MediaModule extends TiModule
\nThanks
(from [6120037dfd4e15f287cb9c058414ee79d55678c5])\n[#1256 state:fixed-in-qa]: Make media module\ncontext-specific so that openPhotoGallery() callbacks will continue\nto work even after new windows are opened. \nhttp://github.com/appcelerator/titanium_mobile/commit/6120037dfd4e1...
confirmed fixed in 1.4.1
\nvalid, needs testcase