I want to do some actions when I change the date in a DatePicker
, but this actions I want to be performed only when I remove the finger from the DatePicker
(last date chosen), so the OnDateChangedListener()
is not useful for me.
So I thought that an OnTouchListener()
from the View
class were that I was looking for:
datePicker.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
Log.i("Evento", String.valueOf(motionEvent.getAction()));
if (motionEvent.getAction() == MotionEvent.ACTION_UP) {
// Actions to be performed
.....
}
return true;
}
});
But it doesn't work. I watched the logs and the event is detected only just outside of the spinners (but into the View
). Doesn't work when I touch the spinners itself.
Can someone help me on how to do to launch an event when I remove the finger from the DatePicker
?