title: Android progress dialog
body: <p>My application fetches some html code from the internet and when done , displays it on the devices screen. Since it takes about 3-4 seconds to do that , in this time the screen stays black , I'd like to use a progress dialog. This is my code :</p>
  
  <pre><code>package com.nextlogic.golfnews;
  
  
  
  // ALL THE IMPORTS ....
  
  public class Activity1 extends Activity {
  
      private ProgressDialog progressDialog;
   @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main2);
  
          progressDialog = ProgressDialog.show(Activity1.this, "", "Loading...");
          new Thread() 
          {
            public void run() 
            {
  
               try
                 {
                  sleep(2000);
  
            // HERE I'VE PUT ALL THE FUNCTIONS THAT WORK FOR ME
   }
      catch (Exception e)
      {
          Log.e("tag",e.getMessage());
      }
  // dismiss the progressdialog   
    progressDialog.dismiss();
   }
  }.start();
  </code></pre>
  
  <p>The program works but it doesn't display anything anymore.  I have one error in logcat : </p>
  
  <pre><code>Only the original thread that created a view hierarchy can touch its views.
  </code></pre>
  
  <p>Could you please help me ? Thanks in advance.</p>