Titanium JIRA Archive
Appcelerator Community (AC)

[AC-1403] showDatePickerDialog - Runtime Error - Android 2.3 - Ti SDK 3.4.0.GA

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionFixed
Resolution Date2015-06-26T22:55:56.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK & CLI
Labels3.4.0, Android, TCSupportTriage, datepicker
ReporterMichael Browne
AssigneeRadamantis Torres-Lechuga
Created2014-10-01T12:49:56.000+0000
Updated2016-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();

Comments

  1. Manoj Kumar 2014-11-27

    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.
  2. Radamantis Torres-Lechuga 2015-06-26

    Works as expected using SDK 4.0.0

JSON Source