title: android popup window doesn't show?
body: <p>I have a popup window that gets called from a listener in my fragment. Before it was called from a button press and it displayed immediately. However, after moving the method that creates it to a custom listener, it no longer pop ups instantly. But rather only after a click event or scroll event occurs anywhere on the screen. I'm guessing the screen needs to be refreshed somehow to show the popup? Here's my creating code:</p>
  
  <pre><code>  /***POP UP WINDOW CODE***/
  
  PopupWindow popupMessage;
  PopupWindow pw;
  
  @SuppressLint("NewApi")
  private void popupInit(){
  
         LayoutInflater inflater = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  
          //Get screen dimensions to set the window size
          Display display = getActivity().getWindowManager().getDefaultDisplay();
          Point size = new Point();
          display.getSize(size);
          int width = size.x;
          int height = size.y;
  
          final View layout = inflater.inflate(R.layout.add_interview, null, false);
  
           // create a 300px width and 470px height PopupWindow
          pw = new PopupWindow(layout, (int) (width*(0.8)), (int) (height*(0.8)), true);
  
          // display the popup in the center
          layout.post(new Runnable() {
                 public void run() {
                   pw.showAtLocation(layout, Gravity.CENTER, 0, 0);
                   pw.update(0, 0, pw.getWidth(), pw.getHeight());
                 }
          });
   }
  </code></pre>