[AC-1403] showDatePickerDialog - Runtime Error - Android 2.3 - Ti SDK 3.4.0.GA
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2015-06-26T22:55:56.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Titanium SDK & CLI |
Labels | 3.4.0, Android, TCSupportTriage, datepicker |
Reporter | Michael Browne |
Assignee | Radamantis Torres-Lechuga |
Created | 2014-10-01T12:49:56.000+0000 |
Updated | 2016-03-08T07:37:49.000+0000 |
Description
When trying to show an Android date picker dialog in an app built with 3.4.0.GA and using version 2.3.7 of Android (Genymotion emulator) a runtime error is displayed.
{quote}
TiExceptionHandler: (main) [0,10633] - Message: Uncaught Error: android.app.DatePickerDialog.getDatePicker
{quote}
This does not happen if the app is built using 3.3.0.GA for Android 2.3.7 or using 3.4.0.GA for Android 4.2.2.
Code to reproduce:
var win = Ti.UI.createWindow({title: "Control Window", backgroundColor: "white", layout: "vertical"});
var bt = Ti.UI.createButton({
title: "Show Date Picker",
top: 10,
height: Ti.UI.SIZE,
width: "95%"
});
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)
});
bt.addEventListener("click", function(){
picker.showDatePickerDialog({
value: new Date(2010,8,1),
callback: function(e) {
if (e.cancel) {
Ti.API.info('User canceled dialog');
} else {
Ti.API.info('User selected date: ' + e.value);
}
}
});
});
win.add( bt );
win.open();
I'm facing the same issue. It seems the problem is with setting minDate and maxDate in 2.3 devices. So I get the os major version, if it is > 2 then set those properties otherwise don't. But this should be handled in PickerProxy.
Works as expected using SDK 4.0.0