title: Progress Dialog usage with Thread
body: <p><strong>here is my code,</strong></p>
  
  <pre><code>public ProgressDialog loadingdialog;
  public void ShowManager() {
      //do something
  }
  public void startScan() {
        loadingdialog = ProgressDialog.show(WifiManagementActivity.this,
                                                "","Scanning Please Wait",true);
        new Thread() {
            public void run() {
                try {
                      sleep(4000);
                      ShowManager();
  
                } catch(Exception e) {
                      Log.e("threadmessage",e.getMessage());
                }
                loadingdialog.dismiss();
            }
        }.start();
      }
  
  startScan();
  </code></pre>
  
  <p>A basic progressdialog show function, but on the line where ShowManager() is called, getting error ,</p>
  
  <pre><code>01-07 23:11:36.081: ERROR/threadmessage(576): Only the original thread 
  that created a view hierarchy can touch its views.
  </code></pre>
  
  <hr>
  
  <p><strong>EDIT:</strong></p>
  
  <p>ShowManager() is a function that change the view elements. shortly something like,</p>
  
  <pre><code>  public void ShowManager() 
    {
        TextView mainText = (TextView) findViewById(R.id.wifiText);
        mainText.setText("editted");
  
    }
  </code></pre>