{ "id": "172514", "key": "AC-5997", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "12217", "key": "AC", "name": "Appcelerator - INBOX", "projectCategory": { "id": "10000", "description": "", "name": "Customer Service" } }, "resolution": { "id": "7", "description": "", "name": "Invalid" }, "resolutiondate": "2018-11-03T21:11:08.000+0000", "created": "2018-10-30T00:18:12.000+0000", "labels": [ "android", "menuItem" ], "versions": [], "issuelinks": [], "assignee": { "name": "shossain", "key": "shossain", "displayName": "Shak Hossain", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2019-01-08T12:05:22.000+0000", "status": { "description": "A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.", "name": "Resolved", "id": "5", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "14548", "name": "Titanium SDK & CLI", "description": "Please enter tickets related to the MobileSDK here." } ], "description": "\r\n{code:java}\r\n\t\t\r\n\t\tvar activity = win.getActivity();\r\n\t\t// Re-create Menu\r\n\t\tif(activity){\r\n\t\t\tactivity.onCreateOptionsMenu = function(e){\r\n\t\t \t\tvar item, menu;\r\n\t\t menu = e.menu;\r\n\t\t menu.clear();\r\n\t\t\t var menuItem = menu.add({\r\n\t\t\t visible: true,\r\n\t\t\t title: 'title1',\r\n\t\t\t showAsAction : Ti.Android.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW\r\n\t\t\t });\r\n\t\t\t var menuItem2 = menu.add({\r\n\t\t\t title : \"title2\",\r\n\t\t\t visible: true,\r\n\t\t\t showAsAction : Ti.Android.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW\r\n\t\t\t }); \r\n\t\t\t menuItem.addEventListener('click', function(e){\r\n\t\t\t \t\tconsole.log(\"aaaaa\");\r\n\t\t\t });\r\n\t\t\t activity.invalidateOptionsMenu();\r\n\t\t\t};\r\n\t\t}\r\n\t\r\n{code}\r\n\r\n\r\n{noformat}\r\n[ERROR] : TiExceptionHandler: (main) [158,158] menuItem.addEventListener('click', function(e){\r\n[ERROR] : TiExceptionHandler: ^\r\n[ERROR] : TiExceptionHandler: TypeError: menuItem.addEventListener is not a function\r\n[ERROR] : TiExceptionHandler: at Activity.activity.onCreateOptionsMenu (eval at Module._compile (/app.js:728:13), :404:14)\r\n[ERROR] : V8Exception: Exception occurred at undefined:404: Uncaught TypeError: menuItem.addEventListener is not a function\r\n{noformat}", "attachment": [], "flagged": false, "summary": "Android activity.onCreateOptionsMenu itemMenu does not support addEventListener", "creator": { "name": "otto.pic", "key": "otto.pic", "displayName": "Lorenzo Piccinini", "active": true, "timeZone": "Europe/Rome" }, "subtasks": [], "reporter": { "name": "otto.pic", "key": "otto.pic", "displayName": "Lorenzo Piccinini", "active": true, "timeZone": "Europe/Rome" }, "environment": null, "comment": { "comments": [ { "id": "443227", "author": { "name": "otto.pic", "key": "otto.pic", "displayName": "Lorenzo Piccinini", "active": true, "timeZone": "Europe/Rome" }, "body": "You can close this ticket, it's not a bug, I solve it, mixed problems in my code.", "updateAuthor": { "name": "otto.pic", "key": "otto.pic", "displayName": "Lorenzo Piccinini", "active": true, "timeZone": "Europe/Rome" }, "created": "2018-11-02T10:07:44.000+0000", "updated": "2018-11-02T10:07:44.000+0000" }, { "id": "445071", "author": { "name": "Andrea.Vitale", "key": "andrea.vitale", "displayName": "Andrea Vitale", "active": true, "timeZone": "Europe/Berlin" }, "body": "@Lorenzo can you please give a description about your code?\r\nI too cannot call _addEventListener_ on MenuItems.\r\nHow did you solve it?", "updateAuthor": { "name": "Andrea.Vitale", "key": "andrea.vitale", "displayName": "Andrea Vitale", "active": true, "timeZone": "Europe/Berlin" }, "created": "2019-01-08T12:05:22.000+0000", "updated": "2019-01-08T12:05:22.000+0000" } ], "maxResults": 2, "total": 2, "startAt": 0 } } }