Project: titanium
Issue TIMOB-19192: Android: Date & Time Picker change event not fired nor is picker.value updated
On Android 5, the Titanium date picker is broken. 1. 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. 2. 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. {code:javascript} Ti.UI.backgroundColor = 'white'; var win = Ti.UI.createWindow({ exitOnClose: true, layout: 'vertical' }); var picker = Ti.UI.createPicker({ type:Ti.UI.PICKER_TYPE_DATE, minDate:new Date(2009,0,1), maxDate:new Date(2014,11,31), value:new Date(2014,3,12), top:50 }); win.add(picker); win.open(); picker.addEventListener('change',function(e){ alert("User selected date: " + e.value.toLocaleString()); }); setTimeout(function() { alert('picker.value: ' + picker.value); }, 10000); {code} Note that this alternative approach works: {code:javascript} Ti.UI.backgroundColor = 'white'; var picker = Ti.UI.createPicker({ type:Ti.UI.PICKER_TYPE_DATE, minDate:new Date(2009,0,1), maxDate:new Date(2014,11,31), value:new Date(2014,3,12) }); picker.showDatePickerDialog({ value: new Date(2010,8,1), callback: function(e) { if (e.cancel) { alert('User canceled dialog'); } else { alert('User selected date: ' + e.value); } } }); {code}
Story points: 5