There is an event listener in Android called DatePicker.OnDateChangedListener. I am trying to set a DatePicker view's on date changed listener as follows:
DatePicker dp = new DatePicker(getContext());
dp.setOnDateChangedListener(this);
//where this is my activity extends DatePicker.OnDateChangedListener
But guess what? Date picker does not have a method called setOnDateChangedListener.
My question is:
Any documentation/tutorials will be very helpful.
Once you've created your DatePicker
, you need to initialize it with the date you want to display at first. That's the point at which you can add your listener.