How To Handle Date Picker Dialog Not To Set In Edittext When Clicked Outside Of Dialog Android?
When I click edittext, date picker dialog opens. without clicking done button in date picker and clicked outside of dialog, it sets in edittext. I checked this but this works for
Solution 1:
@Override
public void onDateSet(DatePicker view, int selectedYear,
int selectedMonth, int selectedDay) {
if(view.isShown()) {
if (fired) {
Log.e("DatePicker", "Ignoring for first time");
birthDayValue = selectedDay;
birthMonthValue = selectedMonth;
birthYearValue = selectedYear;
String birthDayDateFormt = Utils.getBirthDayDate(selectedYear,
selectedMonth, selectedDay);
dateOfBirth.setText(birthDayDateFormt);
dateOfBirth.setError(null);
return;//ignore and return.
}
fired = true;//first time fired
}
}
if(view.isShown()) add code in this condition, its a simple step do it and check output
Post a Comment for "How To Handle Date Picker Dialog Not To Set In Edittext When Clicked Outside Of Dialog Android?"