I have an utils class which vll return a dialog to the activity in my application. In that i need to provide the user to dismiss the dialog on outside click.So here i used like this
lDialog.setCancelable( true );
lDialog.setCanceledOnTouchOutside( true );
I refereed some of these links Here & here
Even i checked with these flags as well
lDialog.getWindow().setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL,
WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL);
lDialog.getWindow().setFlags(LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH, LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH);
But it is not working for me.. i refer too many answers from SOF but unfortunately nothing is worked for me..
Here is my full set of code which i tried so far. It is working perfect except the outside touch dismiss event..
public static Dialog createDialog( Context context,
int viewId )
{
Dialog lDialog = new Dialog( context,
AlertDialog.THEME_HOLO_LIGHT );
lDialog.getWindow().setBackgroundDrawable( new ColorDrawable( 1 ) );
lDialog.requestWindowFeature( Window.FEATURE_NO_TITLE );
lDialog.setContentView( viewId );
lDialog.setCancelable( true );
lDialog.setCanceledOnTouchOutside( true );
lDialog.getWindow().setSoftInputMode( WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN );
return lDialog;
}
Sorry for my poor English!! Thank you.
Here, Finally i am going to answer my question.
Using AlertDialog.THEME_HOLO_LIGHT won't works if you want the dialog to be full screen. An alternative is to create your own style, like so:
have style.xml in values folder like below:::
also add colors.xml in values folder:::
This is working for me. Hope it will works for you as well :)