title: Checking if task in another thread has already finished in Android
body: <p>I'm working on downloading a html source from website and displaying it on TextView. It's being downloaded in another thread and I want to display it when it'll be finished. So. i have to pause main thread until it finish. Right now i do it like this: </p>
  
  <pre><code>    MyAsyncTask task = new MyAsyncTask(this);
      task.execute();
      Thread.sleep(6000);
      ((TextView) findViewById(R.id.textView1)).setText(task.result);
  </code></pre>
  
  <p>But as you see it's not the best way to do this. I need something like "sleepUntil(boolean is MyTaskCompleated)". Is there something like this in Java. Or is there any better way to do it?</p>