how to handle "Only the original thread that created a view hierarchy can touch its views.”
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/3280141/android-calledfromwrongthreadexception-only-the-original-thread-that-created">Android : CalledFromWrongThreadException;: Only the original thread that created a view hierarchy can touch its views</a>  </p>
</blockquote>



<p>Now I am working on an application.I want to show a progressbar until i get a true reply from called method.I used the following code.</p>

<pre><code> progressBar = new ProgressDialog(this);
      progressBar.setCancelable(true);
      progressBar.setMessage("Loading");
      progressBar.show();

new Thread(new Runnable() {


    @Override
    public void run() {
        // TODO Auto-generated method stub

        final boolean flag=  GetFixtureDetailsJsonFunction();

        if (flag==true) {
            try {
                Thread.sleep(2000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }

            progressBar.dismiss();
        }

    }
}).start();



protected boolean GetFixtureDetailsJsonFunction()
{ 
  //some code
  return true;
}
</code></pre>

<p>But I am getting the exception </p>

<pre><code>03-14 15:48:23.722: E/AndroidRuntime(910): android.view.ViewRoot$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.
</code></pre>

<p>Please help me friends</p>
