0

I have a datepicker from here that I have to enable and disable with a button click. I tried:

datepicker.setActivated(false);
datepicker.setEnabled(false);
datepicker.setClickable(false);
datepicker.setFocusable(false);
datepicker.setFocusableInTouchMode(false);

but nothing works. I even tried putting the datepickerdialog inside a layout and put the same settings on the layout but didn't work as well.

Thanks in advance.

Lendl Leyba
  • 2,287
  • 3
  • 34
  • 49

2 Answers2

0

Make sure that you declare datepicker object globally bind this datepicker object inside onCreate() using findViewById() method.

Akshay Abhyankar
  • 599
  • 1
  • 4
  • 11
  • Yep, I have that. I even put a breakpoint on the part where it is set as not activated, and it ... how do I say that, successful? Lol. – Lendl Leyba Apr 11 '14 at 06:48
0

I got it to working this way. To disable the datepicker, select the date you want to display and

datePickerView.updateDate(year, month, day);
datePickerView.setMinDate(dateObject.getTime());
datePickerView.setMaxDate(dateObject.getTime());

To enable it back, set it accordingly to default or previous values.