When the popupwindow is active, I want to make the screen into dimmer or blur expect selected view. Same like below mentioned image.

I have tried the below code but its dimming entire screen
public static void dimBehind(PopupWindow popupWindow) {
       View container = popupWindow.getContentView().getRootView();
       Context context = popupWindow.getContentView().getContext();
       WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
       WindowManager.LayoutParams p = (WindowManager.LayoutParams) container.getLayoutParams();
       p.flags |= WindowManager.LayoutParams.FLAG_DIM_BEHIND;
       p.screenBrightness=
       p.dimAmount = 0.3f;
       wm.updateViewLayout(container, p);
   }
below code is for popup window
public void showpopupwindow(View view){
       LayoutInflater layoutInflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
       View customView = layoutInflater.inflate(R.layout.popup,null);
       //instantiate popup window
       PopupWindow  popupWindow = new PopupWindow(mContext);
       popupWindow.setContentView(customView);
       popupWindow.setHeight(WindowManager.LayoutParams.WRAP_CONTENT);
       popupWindow.setWidth(WindowManager.LayoutParams.WRAP_CONTENT);
       popupWindow.setFocusable(true);
       //display the popup window
       popupWindow.showAsDropDown(view);
       dimBehind(popupWindow);
       TextView textView1,textView2,textView3,textView4;
       textView1=customView.findViewById(R.id.textview1);
       textView2=customView.findViewById(R.id.textview2);
       textView3=customView.findViewById(R.id.textview3);
       textView4=customView.findViewById(R.id.textview4);
   }
Please help me.....