Remove black background on custom dialog

Try this:

myDialog.getWindow().clearFlags(LayoutParams.FLAG_DIM_BEHIND);

public MyAlertDialog(
        Context context, 
        int theme
    ) extends AlertDialog { 

    super(context, theme);
    getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
}

Sonehow getWindow().setBackgroundDrawable() didn't work for me with AlertDialog. I found an easier solution using Dialog. Here's my code -

        final Dialog dialog = new Dialog(this);
        dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
        dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
        dialog.setContentView(R.layout.popup_window);
        dialog.show();