title: How to create PopupWindow on startup in android?
body: <p>It is possible using <strong>Dialog</strong> class but I do not want it that way. Instead I want it to be done by using <strong>PopupWindow</strong> class which gets popped up on startup and display some message on the popup. I am helpless, just can not getting this after spending many days behind it. Hope I get it here. Please and Thanks. Also look at below snippet if you didn't get what I want..</p>
  
  <pre><code>public class PopupActivity extends Activity implements OnClickListener {
  
      LinearLayout ll = new LinearLayout(this);
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(ll);
      }
  
      protected void onStart() {
          super.onStart();
          final PopupWindow pw;
          Button button = new Button(this);
          button.setText("Hello");
          pw = new PopupWindow(button, 245, 284, true);
  
          button.setOnClickListener(new OnClickListener() {  
              @Override  
              public void onClick(View view) {  
                  pw.dismiss();            
              }  
          });
  
          pw.showAsDropDown(ll, 10, -50);
      }
  }
  </code></pre>
  
  <p>Above code gives me FORCE CLOSE :/ Help guys..</p>