title: can't dismiss popUpWindow
body: <p>i created my popUp window</p>
  
  <pre><code> public void myPopUp()
      {
  
          LinearLayout myView = new LinearLayout(getApplicationContext());
           pw = new PopupWindow(getApplicationContext());
           pw.setContentView(myView);
           myView.setBackgroundColor(Color.WHITE);
           pw.setWidth(curWidth-100);
           pw.setHeight(curHeight-100);
           pw.showAtLocation(background, Gravity.CENTER, 0, 0);
     }
  </code></pre>
  
  <p>and overrided backButton pressed for dissmis </p>
  
  <pre><code>public boolean onKeyDown(int keyCode, KeyEvent event) {
          if (keyCode == KeyEvent.KEYCODE_BACK) {
              getNewWH();
                 middle.removeView(bb);
              if(statusBG==2)
              {
                   log("statusBG = "+statusBG);
                   showFeed();
                   statusBG=1;
              }
              else
              if(statusBG==1)
                  { 
                      finish();
                  }
              else
              if (pw.isShowing()) {
                   log("here again");
                  pw.dismiss();
                  log("here");
  
              }
            return true;  
          }
          return super.onKeyDown(keyCode, event);
      }
  </code></pre>
  
  <p>as u can understand me - i want dissmis/hide popupwindow  when i press on backButton but now i get folowing error's  :(</p>
  
  <pre><code>05-12 12:27:15.373: ERROR/WindowManager(1259): Activity myClass.com.myClass has leaked window android.widget.PopupWindow$PopupViewContainer@44ec28a8 that was originally added here
  05-12 12:27:15.373: ERROR/WindowManager(1259): android.view.WindowLeaked: Activity myClass.com.myClass has leaked window android.widget.PopupWindow$PopupViewContainer@44ec28a8 that was originally added here
  05-12 12:27:15.373: ERROR/WindowManager(1259):     at android.view.ViewRoot.&lt;init&gt;(ViewRoot.java:247)
  05-12 12:27:15.373: ERROR/WindowManager(1259):     at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:148)
  05-12 12:27:15.373: ERROR/WindowManager(1259):     at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91)
  05-12 12:27:15.373: ERROR/WindowManager(1259):     at android.widget.PopupWindow.invokePopup(PopupWindow.java:828)
  05-12 12:27:15.373: ERROR/WindowManager(1259):     at android.widget.PopupWindow.showAtLocation(PopupWindow.java:688)
  05-12 12:27:15.373: ERROR/WindowManager(1259):     at myClass.com.myClass.myPopUp(myClass.java:743)
  05-12 12:27:15.373: ERROR/WindowManager(1259):     at myClass.com.myClass$15.onClick(myClass.java:724)
  05-12 12:27:15.373: ERROR/WindowManager(1259):     at android.view.View.performClick(View.java:2408)
  05-12 12:27:15.373: ERROR/WindowManager(1259):     at android.view.View$PerformClick.run(View.java:8816)
  05-12 12:27:15.373: ERROR/WindowManager(1259):     at android.os.Handler.handleCallback(Handler.java:587)
  05-12 12:27:15.373: ERROR/WindowManager(1259):     at android.os.Handler.dispatchMessage(Handler.java:92)
  05-12 12:27:15.373: ERROR/WindowManager(1259):     at android.os.Looper.loop(Looper.java:123)
  05-12 12:27:15.373: ERROR/WindowManager(1259):     at android.app.ActivityThread.main(ActivityThread.java:4627)
  05-12 12:27:15.373: ERROR/WindowManager(1259):     at java.lang.reflect.Method.invokeNative(Native Method)
  05-12 12:27:15.373: ERROR/WindowManager(1259):     at java.lang.reflect.Method.invoke(Method.java:521)
  05-12 12:27:15.373: ERROR/WindowManager(1259):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
  05-12 12:27:15.373: ERROR/WindowManager(1259):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
  05-12 12:27:15.373: ERROR/WindowManager(1259):     at dalvik.system.NativeStart.main(Native Method)
  </code></pre>
  
  <p>can anyone help me  and tell how to correct dismis popup when i pressed on backButton ? </p>
  
  <p>p.s. sorry for my bad english, hope u understand me . Regards, Peter.</p>