Android Datepicker In Spinner Mode Not Showing Date
I'm using DatePicker in spinner mode, and sets min and max limit. Then updates the date as max value. Date column does not have a value when the DatePickerDialog shown. When I tap/
Solution 1:
There seems to have bug in the android widget DatePicker
in the spinner
mode. Already such a ticket present in the Google issue tracker also : https://issuetracker.google.com/issues/64508670
Unfortunately no work around or suggestions available in the issue tracker.
Solution 2:
Had the same issue. Solved it like that:
datePicker.init(initYear, initMonthOfYear, initDayOfMonth,
newDatePicker.OnDateChangedListener() {
@OverridepublicvoidonDateChanged(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
Resourcesres= Resources.getSystem();
intid= res.getIdentifier("day", "id", "android");
NumberPickerdayPicker= datePicker.getRootView().findViewById(id);
if (dayPicker != null) {
id = res.getIdentifier("numberpicker_input", "id", "android");
TextViewinputText= dayPicker.findViewById(id);
if (inputText != null && TextUtils.isEmpty(inputText.getText())) {
inputText.setText(String.valueOf(dayPicker.getValue()));
}
}
}
});
Post a Comment for "Android Datepicker In Spinner Mode Not Showing Date"