title: Darken Background after Popup window opened android
body: <p>I want to dark the background after popup window open and restore everything like before after dismissing. I have searched google and seen some tutorial also. But I don't be able to understand how it is possible. Here's My Java Code:</p>
  
  <pre><code>public void displayPopupWindow() {
      View layout = getLayoutInflater().inflate(R.layout.popup,null);
      final PopupWindow popup = new PopupWindow(this);
      popup.setContentView(layout);
      popup.setOutsideTouchable(true);
      popup.setFocusable(true);
      popup.setWidth(400);
      popup.setHeight(580);
      popup.showAtLocation(layout, Gravity.CENTER, 0, 0);
      popup.setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
      Button button = (Button) layout.findViewById(R.id.button);
      button.setOnClickListener(new View.OnClickListener() {
          public void onClick(View layout) {
              popup.dismiss();
          }
      });
  
  }
  </code></pre>
  
  <p>Here my popup xml code:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:background="@color/colorPrimary"
  android:id="@+id/popup"
  &gt;
  Various views and button
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>What should I do now?</p>