{ "id": "147344", "key": "TIMOB-19192", "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": "16997", "name": "Release 5.2.0", "archived": false, "released": true, "releaseDate": "2016-02-23" } ], "resolution": { "id": "3", "description": "The problem is a duplicate of an existing issue.", "name": "Duplicate" }, "resolutiondate": "2015-10-01T23:24:28.000+0000", "created": "2015-04-28T15:21:32.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "datepicker" ], "versions": [], "issuelinks": [ { "id": "48879", "type": { "id": "10002", "name": "Duplicate", "inward": "is duplicated by", "outward": "duplicates" }, "inwardIssue": { "id": "150355", "key": "TIMOB-19345", "fields": { "summary": "Android: DatePicker change event does not fires in Lollipop", "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": "High", "id": "2" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "updated": "2016-01-19T17:03:35.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": "On Android 5, the Titanium date picker is broken.\r\n\r\n1. It no longer fires the changed event so you can't obtain the selected value as it updates. This happens whether on Ti SDK 4.X or 3.5.1.GA.\r\n2. It no longer updates the picker.value so you can't obtain the selected value on demand. This works on Ti SDK 3.5.1.GA, so seems to be an issue only on Ti SDK 4.X.\r\n\r\n{code:javascript}\r\nTi.UI.backgroundColor = 'white';\r\nvar win = Ti.UI.createWindow({\r\n exitOnClose: true,\r\n layout: 'vertical'\r\n});\r\n\r\nvar picker = Ti.UI.createPicker({\r\n type:Ti.UI.PICKER_TYPE_DATE,\r\n minDate:new Date(2009,0,1),\r\n maxDate:new Date(2014,11,31),\r\n value:new Date(2014,3,12),\r\n top:50\r\n});\r\n\r\nwin.add(picker);\r\nwin.open();\r\n\r\npicker.addEventListener('change',function(e){\r\n alert(\"User selected date: \" + e.value.toLocaleString());\r\n});\r\n\r\nsetTimeout(function() {\r\n alert('picker.value: ' + picker.value);\r\n}, 10000);\r\n{code}\r\n\r\n\r\nNote that this alternative approach works:\r\n\r\n\r\n{code:javascript}\r\nTi.UI.backgroundColor = 'white';\r\n\r\nvar picker = Ti.UI.createPicker({\r\n type:Ti.UI.PICKER_TYPE_DATE,\r\n minDate:new Date(2009,0,1),\r\n maxDate:new Date(2014,11,31),\r\n value:new Date(2014,3,12)\r\n});\r\n\r\npicker.showDatePickerDialog({\r\n value: new Date(2010,8,1),\r\n callback: function(e) {\r\n if (e.cancel) {\r\n alert('User canceled dialog');\r\n } else {\r\n alert('User selected date: ' + e.value);\r\n }\r\n }\r\n});\r\n{code}", "attachment": [ { "id": "55168", "filename": "Ti SDK3.5.1 GA.png", "author": { "name": "hmrida", "key": "hmrida", "displayName": "Harish Mridha", "active": true, "timeZone": "Asia/Dhaka" }, "created": "2015-04-29T06:47:55.000+0000", "size": 70453, "mimeType": "image/png" }, { "id": "55169", "filename": "Ti SDK 4.0.0 RC.png", "author": { "name": "hmrida", "key": "hmrida", "displayName": "Harish Mridha", "active": true, "timeZone": "Asia/Dhaka" }, "created": "2015-04-29T06:47:52.000+0000", "size": 57318, "mimeType": "image/png" } ], "flagged": false, "summary": "Android: Date & Time Picker change event not fired nor is picker.value updated", "creator": { "name": "jtoth", "key": "jtoth", "displayName": "Justin Toth", "active": true, "timeZone": "America/New_York" }, "subtasks": [], "reporter": { "name": "jtoth", "key": "jtoth", "displayName": "Justin Toth", "active": true, "timeZone": "America/New_York" }, "environment": "Android 5\r\nTitanium SDK 4.1.0.v20150427212043", "closedSprints": [ { "id": 445, "state": "closed", "name": "2015 Sprint 15 SDK", "startDate": "2015-07-18T00:30:28.848Z", "endDate": "2015-08-01T00:30:00.000Z", "completeDate": "2015-08-03T01:49:18.234Z", "originBoardId": 114 }, { "id": 494, "state": "closed", "name": "2015 Sprint 20 SDK", "startDate": "2015-09-26T00:29:19.845Z", "endDate": "2015-10-10T00:29:00.000Z", "completeDate": "2015-10-12T05:33:30.964Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "357283", "author": { "name": "michielve", "key": "michielve", "displayName": "Michiel van Eerd", "active": true, "timeZone": "Europe/Berlin" }, "body": "This also affects the time picker (UI.PICKER_TYPE_TIME) when building with SDK 4.0.0 on Android. This has even more impact than the DATE picker, because the showDatePickerDialog() method does not show TIME pickers, so we have no way to get the value of TIME pickers in SDK 4.0.0!", "updateAuthor": { "name": "michielve", "key": "michielve", "displayName": "Michiel van Eerd", "active": true, "timeZone": "Europe/Berlin" }, "created": "2015-07-08T12:56:56.000+0000", "updated": "2015-07-08T12:56:56.000+0000" }, { "id": "358243", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "body": "Hello [~michielve]. May I know which version of Android you are using and the device?", "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2015-07-24T07:23:47.000+0000", "updated": "2015-07-24T07:23:47.000+0000" }, { "id": "358244", "author": { "name": "wilsonliaw", "key": "wilsonliaw", "displayName": "Wilson Liaw", "active": true, "timeZone": "Asia/Shanghai" }, "body": "Android 5.0+ are facing this bug", "updateAuthor": { "name": "wilsonliaw", "key": "wilsonliaw", "displayName": "Wilson Liaw", "active": true, "timeZone": "Asia/Shanghai" }, "created": "2015-07-24T07:32:33.000+0000", "updated": "2015-07-24T07:32:33.000+0000" }, { "id": "358329", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "body": "An update on this issue. This seems to be a native bug in Android 5.0 which Google fixed in Android 5.1.\r\n\r\nAndroid Issue Tracker:-\r\nhttps://code.google.com/p/android/issues/detail?id=147657&can=1&q=onDateChanged&colspec=ID%20Type%20Status%20Owner%20Summary%20Stars", "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2015-07-27T04:06:25.000+0000", "updated": "2015-07-27T04:06:25.000+0000" }, { "id": "358336", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "body": "PR: https://github.com/appcelerator/titanium_mobile/pull/6985", "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2015-07-27T05:47:13.000+0000", "updated": "2015-07-27T05:47:13.000+0000" }, { "id": "358571", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "body": "PR merged.", "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2015-07-30T01:28:03.000+0000", "updated": "2015-07-30T01:28:03.000+0000" }, { "id": "360262", "author": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "body": "The issue persists on android 5.0.X. \r\nThe change event only fires once for me.\r\n\r\nReopening.\r\n\r\nEnvironment:\r\nAppc Studio : 4.2.0.201508062204\r\nTi SDK : 5.0.0.v20150818082827\r\nTi CLI : 4.1.4\r\nAlloy : 1.6.2\r\nMAC Yosemite : 10.10.4\r\nAppc NPM : 4.1.0\r\nAppc CLI : 4.2.0-57\r\nNode: v0.10.37\r\nOne plus one - Android 5.0.1\r\nNode : v0.10.37", "updateAuthor": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2015-08-18T22:41:05.000+0000", "updated": "2015-08-18T22:41:05.000+0000" }, { "id": "360837", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "body": "[~lchoudhary]\r\nCould you describe what you did exactly and the results of it? Thanks!", "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2015-08-24T03:37:08.000+0000", "updated": "2015-08-24T03:37:08.000+0000" }, { "id": "360963", "author": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~msamah]- I ran the code above on an android 5.0.X device & the alert on a change event was fired only once/first time after launching the app & changing the date.", "updateAuthor": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2015-08-24T17:48:00.000+0000", "updated": "2015-08-24T17:54:49.000+0000" }, { "id": "361033", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "body": "I'm currently using HTC Desire Eye running Android version 5.0.2 and it is working for me. I can change and the value is updated multiple times. \r\n\r\nThis code is working fine for me on the Master branch.\r\n{code}\r\npicker2.addEventListener('change',function(e){\r\n \r\n \r\n alert(\"User selected date: \" + e.value.toLocaleString());\r\n \r\n \r\n});\r\n{code}", "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2015-08-25T04:58:36.000+0000", "updated": "2015-08-25T04:58:36.000+0000" }, { "id": "361034", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "body": "Could you let me know which test code you are using as well as the device information?", "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2015-08-25T04:59:20.000+0000", "updated": "2015-08-25T04:59:20.000+0000" }, { "id": "361049", "author": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~msamah], I am using the code in the description & in your PR on git hub.\r\nDevice used is One Plus One - Android 5.0.1\r\n\r\n", "updateAuthor": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2015-08-25T06:35:50.000+0000", "updated": "2015-08-25T06:35:50.000+0000" }, { "id": "361050", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "body": "Thank you for the info. Will look into it.", "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2015-08-25T06:37:07.000+0000", "updated": "2015-08-25T06:37:07.000+0000" }, { "id": "361060", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "body": "[~lchoudhary], could you try this on an Android 5.0.0 and Android 5.0.2? I would like to know if it's affected as well.", "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2015-08-25T07:23:56.000+0000", "updated": "2015-08-25T07:23:56.000+0000" }, { "id": "361124", "author": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~msamah], On checking today with build 5.0.0.v20150825082243 I see a different behaviour, on android 5.0 emulator, One plus one - android 5.0.2 & android 5.0.1 emulator, I get alert twice for a change event.\r\n\r\nEnvironment:\r\nAppc Studio : 4.2.0.201508141038\r\nTi SDK : 5.0.0.v20150825082243\r\nTi CLI : 4.1.5\r\nAlloy : 1.7.5\r\nMAC Yosemite : 10.10.4\r\nAppc NPM : 4.2.0-1\r\nAppc CLI : 5.0.0-14\r\nNode: v0.10.37\r\nNexus 5 - Android 5.1.1\r\nNode : v0.10.37", "updateAuthor": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2015-08-25T16:27:16.000+0000", "updated": "2015-08-25T16:27:16.000+0000" }, { "id": "361686", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "body": "PR for fix: https://github.com/appcelerator/titanium_mobile/pull/7094", "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2015-08-31T03:51:28.000+0000", "updated": "2015-08-31T03:51:28.000+0000" }, { "id": "361687", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "body": "PR merged", "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2015-08-31T03:51:38.000+0000", "updated": "2015-08-31T03:51:38.000+0000" }, { "id": "361858", "author": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~msamah], I did not get what does you fix does. I don't see the alert for the change event again.\r\nchecked with the code in the description on android 5.0.0.\r\nReopening.\r\n\r\nEnvironment:\r\nAppc Studio : 5.0.0.201508251028\r\nTi SDK : 5.0.0.v20150831142846\r\nTi CLI : 4.1.5\r\nAlloy : 1.7.6\r\nMAC Yosemite : 10.10.4\r\nAppc NPM : 4.1.0-2\r\nAppc CLI : 5.0.0-33\r\nNode: v0.10.37\r\nNexus 5 - Android 5.0.0\r\nNode : v0.10.37", "updateAuthor": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2015-09-01T01:14:13.000+0000", "updated": "2015-09-01T01:14:13.000+0000" }, { "id": "361863", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "body": "Test code I used was: \r\n{code}\r\nvar vidWin = Titanium.UI.createWindow({\r\n title : 'Video View Demo',\r\n backgroundColor : '#000'\r\n});\r\n \r\nvar picker = Ti.UI.createPicker({\r\n type:Ti.UI.PICKER_TYPE_DATE,\r\n minDate:new Date(2009,0,1),\r\n maxDate:new Date(2014,11,31),\r\n value:new Date(2014,3,12)\r\n});\r\nvar button = Titanium.UI.createButton({\r\n title: 'Picker',\r\n top: 10,\r\n width: 100,\r\n height: 50\r\n});\r\nbutton.addEventListener('click',function(e)\r\n{\r\n\tpicker.showDatePickerDialog({\r\n\t value: new Date(2010,8,1),\r\n\t callback: function(e) {\r\n\t if (e.cancel) {\r\n\t alert('User canceled dialog');\r\n\t } else {\r\n\t alert('User selected date: ' + e.value);\r\n\t }\r\n\t }\r\n\t});\r\n});\r\n \r\n///\r\n \r\n \r\nvar picker2 = Ti.UI.createPicker({\r\n type:Ti.UI.PICKER_TYPE_DATE,\r\n minDate:new Date(2009,0,1),\r\n maxDate:new Date(2014,11,31),\r\n value:new Date(2014,3,12),\r\n top:120\r\n});\r\npicker2.addEventListener('change',function(e){\r\n \r\n \r\n alert(\"User selected date: \" + e.value.toLocaleString());\r\n \r\n \r\n});\r\n \r\nvar button2 = Titanium.UI.createButton({\r\n title: 'Picker',\r\n top: 60,\r\n width: 100,\r\n height: 50\r\n});\r\nbutton2.addEventListener('click',function(e)\r\n{\r\n\t alert('picker2.value: ' + picker2.value);\r\n});\r\n \r\nvidWin.add(button);\r\nvidWin.add(picker2);\r\nvidWin.add(button2);\r\nvidWin.open();\r\n{code}\r\n\r\nIs it possible for u to test it on a 5.0.0, 5.0.1 and 5.0.2? I'll look into this more.", "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2015-09-01T02:19:11.000+0000", "updated": "2015-09-01T02:19:11.000+0000" }, { "id": "361871", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "body": "Reverting the PR: https://github.com/appcelerator/titanium_mobile/pull/7105", "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2015-09-01T03:11:35.000+0000", "updated": "2015-09-01T03:11:35.000+0000" }, { "id": "362151", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "body": "Tried the code on Android 5.0.2 with latest Master and callback is called twice.\r\n\r\nTried this natively on Android Studio with native code and callback is called twice. Seems to be a native issue.", "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2015-09-03T06:56:56.000+0000", "updated": "2015-09-03T06:56:56.000+0000" }, { "id": "362255", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "body": "Creating and running a simple native app on Android Studio with the Date Picker does indeed call the callback twice when changing the date.\r\n\r\nWhat would be a good way to resolve this issue?", "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2015-09-04T02:56:09.000+0000", "updated": "2015-09-04T02:56:09.000+0000" }, { "id": "365594", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2015-10-01T23:24:05.000+0000", "updated": "2015-10-01T23:24:05.000+0000" }, { "id": "374836", "author": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Closing as duplicate.", "updateAuthor": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-01-19T17:03:07.000+0000", "updated": "2016-01-19T17:03:07.000+0000" } ], "maxResults": 36, "total": 36, "startAt": 0 } } }