title: Using a progressdialog and handler
body: <p>I'm working on an app that connect to a webpage to get some content. I want to show a progressdialog, but I think I'm doing something wrong.</p>
  
  <p>This is my code:</p>
  
  <pre><code>        final ProgressDialog myProgressDialog = ProgressDialog.show(WhoisBeyondActivity.this, "Wait...", "Fetching data...", true);
          Handler handler=new Handler();
          handler.post(new Runnable()
              {
                  public void run()
                  {
                      try {
                          // code to execute
                          Thread.sleep(2000);
                      } catch (Exception e) {
  
                      }
                      myProgressDialog.dismiss();
                  }
              });
  </code></pre>
  
  <p>The problem is that the progressdialog is only shown one second at the end of the operation I want to make. I think the progressdialog is only executing when I execute the dismiss() because it appears and dissapears quickly. Is like the progressdialog appears only to dissapear ... help me please!!! I have read a lot of tutorials, and I have try a lot of option, like THREAD instead of HANDLER, but it is not usefull for me, because I have to edit UI.</p>