dialog background dimming in android
Window window = dialog.getWindow();
if(window != null){
window.addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); // This flag is required to set otherwise the setDimAmount method will not show any effect
window.setDimAmount(0.5f); //0 for no dim to 1 for full dim
}