get touchEvent outside alertDialog
<p>I have a main view (SurfaceView) in which i open an alertDialog without buttons to show some information. So then the alertDialog is a small window above the main view.</p>

<p>I want to close the alertDialog when the user touch anywhere on the screen.</p>

<p>Until now i can close the alertDialog with the touchEvent in the alertDialog.</p>

<p>Is there an attribute on the alterDialog or on the surfaceView?</p>

<p>Can i kind of activate the touchEvent listener on the surfaceView even the alertDialog is showing?</p>

<p>Android 2.3.3</p>

<p>I found additional Information about my Task on this question: <a href="http://stackoverflow.com/questions/7214365/tap-outside-android-dialog-to-dismiss-it">dialog dismiss</a>.
Now i set this two flags (my dialog is not modal):
FLAG_NOT_TOUCH_MODAL, FLAG_WATCH_OUTSIDE_TOUCH</p>

<p>Unfortunately in the override of the touchevent i never receive the event MotionEvent.ACTION_OUTSIDE when touch outside the dialog. </p>

<p>In my Activity i do this:</p>

<pre><code>alertBuilder.setView(mDialogLayout);
alertDialog = alertBuilder.create();
alertDialog.setOwnerActivity(this);
</code></pre>

<p>And later in a other class i do that:</p>

<pre><code>alertDialog.show();
WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
lp.copyFrom(alertDialog.getWindow().getAttributes());
lp.width = (int)(oJassSurfaceView.oCanvas.getWidth() *Constants.d_FactorResizeDialogWidth);

lp.height = (int)(oJassSurfaceView.oCanvas.getHeight() *Constants.d_FactorResizeDialogHeight);

lp.x=Constants.iX_PositionDialog;

lp.y=Constants.iY_PositionDialog;

alertDialog.getWindow().setAttributes(lp);
alertDialog.getWindow().setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL, WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL);

alertDialog.getWindow().setFlags(WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH, WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH);
</code></pre>

<p>where is the mistake? do i need to follow a certain order when i set the flags?</p>
