title: android fail to show an alert dialog in Handler
body: <p>I tried to show a alert dialog in handler, but i could not show the alert. Could you help me have a look where is the bug?</p>
  
  <pre><code>Handler myHandler = new Handler() {  
      public void handleMessage(Message msg) {
                 myDialog.show();                       
                 super.handleMessage(msg);   
      }   
     };
  
  class myThread implements Runnable {   
     public void run() {  
         try {
  
  
             myHandler.sendMessage(message);  
  
  
         } catch (Exception e) {
             e.printStackTrace();
         }
     } 
  </code></pre>
  
  <p>} </p>
  
  <p>In onCreate:</p>
  
  <pre><code>    myDialog= new AlertDialog.Builder(this).create();
      myDialog.setTitle("hi");
      myDialog.setMessage("thanks");
      myDialog.setButton("Next...",new DialogInterface.OnClickListener()
      {
  
          @Override
          public void onClick(DialogInterface dialog, int which) 
          {
  
          }
      }); 
  
     new Thread(new myThread()).start(); 
  ....
  </code></pre>
  
  <p>I defined myHandler and myThread. Then in onCreate, I defined a dialog. And then call the mythread to run. I suppose the mythread will send a message to myHandler. Myhandler will then trigger the dialog. What is wrong with the logic? thanks.</p>