title: Async program flow/show ProgressDialog
body: <p>I have some code that
  a) needs about 10..20 seconds to execute
  b) returns a value that is used for further processing
  c) is called by the user</p>
  
  <p>Thus I created a structure like this:</p>
  
  <pre><code>ProgressDialog pd = new ProgressDialog(ctx);  
  pd.setCancelable(false);
  pd.setCanceledOnTouchOutside(false);
  pd.setTitle(ctx.getResources().getText(R.string.progress));
  pd.setMessage(ctx.getResources().getText(R.string.wait_keygen));
  pd.setIndeterminate(true);
  
  returnValue=doSomeDifficultCalculationsHere();
  
  pd.dismiss();
  </code></pre>
  
  <p>Now my problems is: the progress dialogue is not shown, it seems to be blocked by the blocking doSomeDifficultCalculationsHere()-function too.</p>
  
  <p>When I place doSomeDifficultCalculationsHere() into an own thread and do a Thread.join() to wait for result of this function progress dialogue is also not shown because Thread.join() blocks.</p>
  
  <p>When I put the ProgressDialog into the thread I get an exception.</p>
  
  <p>So how else can I solve this problem and let the ProgressDialog be shown when I can't call doSomeDifficultCalculationsHere() really asynchronously because its result is needed for all following steps?</p>
  
  <p>Thanks!</p>