I have a FromDate EditText
to which I have added an image. Now when I click the image a Datepicker
is shown. Now when I choose some date and click on Set Button
, the date is set in the EditText
. Problem is that, when I click Cancel Button
, the date picker is gone and the prev activity does not gain focus until I press Back! No touch event works on the screen.
Please help...
I don't believe this could be the best way to do it...but some how the following code works; got some guidance from this link https://stackoverflow.com/a/4981308/840520
dialog.setButton(DialogInterface.BUTTON_NEGATIVE, getString(R.string.cancel), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
if (which == DialogInterface.BUTTON_NEGATIVE) {
dialog.dismiss();
onBackPressed();
}
}
});
Since I have a project delivery, this works for me now.However, I'm still looking for a decent way of handling this. Does android platform doesn't handle the cancel button as it does for other dialogs?