I\'d like to close a dialog window in my android app by simply touching the screen.. is this possible? If so, how?
I\'ve looked into setting some \"onClickEven\" on
If someone still searching for a solution to dismiss a Dialog by onTouch Event, here is a snippet of code:
public void onClick(View v) {
AlertDialog dialog = new AlertDialog(MyActivity.this){
@Override
public boolean dispatchTouchEvent(MotionEvent event)
{
dismiss();
return false;
}
};
dialog.setIcon(R.drawable.MyIcon);
dialog.setTitle("MyTitle");
dialog.setMessage("MyMessage");
dialog.setCanceledOnTouchOutside(true);
dialog.show();
}