title: How to disable back button when popup window dialog is showing?
body: <p>I have a popup window with an <code>EditText</code> input inside. Creation of the popup window looks like this:</p>
  
  <p><code>Boolean focusable = true;
  popupWindow = new PopupWindow(popupView, width, height, focusable);
  </code></p>
  
  <p>This all works well and the <code>EditText</code> can by typed into. The problem arises when the user clicks the back button on the android phone. The back button dismisses the popup window. This should not happen since the intention was the user cannot proceed until an interaction with the popup is made.</p>
  
  <p>Now, we can certainly set the focusability of the popup view to <code>false</code> to prohibit dismissing via the back button:</p>
  
  <p><code>Boolean focusable = false;
  popupWindow = new PopupWindow(popupView, width, height, focusable);
  </code></p>
  
  <p>The problem here now is the <code>EditText</code> does not receive the focus it needs to be able to type. Hence, the user cannot interact with the <code>EditText</code></p>
  
  <p>Any idea how I can solve this problem, either through the popup view or the <code>EditText</code>?</p>
  
  <p>EDIT:</p>
  
  <p>So I tried to override the <code>onBackPress</code> method on the main activity with a logger to check whether the listener is called in the activity:</p>
  
  <pre><code>  @Override
      public void onBackPressed() {
          super.onBackPressed();
          Logger.d("isthistriggered");
          finish();
      }
  </code></pre>
  
  <p>It turns out, the <code>onBackPressed</code> is not called when the popup is alive. Once you press the back button the second time, it triggers the listener.</p>