Question: I want to use an **`activity as dialog`** and i made the theme of the activity as dialog & i succeed.
but
i have the problem here is when i click outside of the activity 
its automatically get closed & the previous activity get started..

i tried a thing to make transparent parent layout it does not look like a dialog..

i want to use this activity to create new account in my application as it has only 3 fields so in tablet it looks large space unused... so i want to use activity as dialog.....

thenx in advance...!!!
examples will be appreciated..!!!!!

Answer: 
try with following property 

```
    this.setFinishOnTouchOutside(false);

```
For the issue of avoiding closing the activity when clicking outside window
from API 11 
as mentioned by Vivek use this.setFinishOnTouchOutside(false);

but for prior APIs use this code:

```
@Override
public boolean onTouchEvent(MotionEvent event) {
    if ( event.getAction() == MotionEvent.ACTION_DOWN &&  isOutOfBounds(this, event)){
        return true;
    }
    return super.onTouchEvent(event);
}

private boolean isOutOfBounds(Activity context, MotionEvent event) {
    final int x = (int) event.getX();
    final int y = (int) event.getY();
    final int slop = ViewConfiguration.get(context).getScaledWindowTouchSlop();
    final View decorView = context.getWindow().getDecorView();
    return (x < -slop) || (y < -slop)
            || (x > (decorView.getWidth()+slop))
            || (y > (decorView.getHeight()+slop));
}

```