title: How to show progressdialog when the main UI thread is blocked?
body: <p>Before I'm lampooned, for blocking the main UI thread, here is the scenario:</p>
  
  <ol>
  <li>A Service runs once a day - takes around 15 secs to complete. Heavy database transactions</li>
  <li>By coincidence the user starts the app during that time</li>
  <li>The home screen loads data from the database</li>
  <li>But because the database is locked (step 1), this throws an error.</li>
  </ol>
  
  <p>So I need to FREEZE the UI thread till the service is completed. No AsyncTask because the UI will continue to execute and throw an error. I've managed to put the "onResume" function to sleep till the service finishes. But during that time I'm unable to show any dialogs telling the user to wait or any progress bar telling the user to sit tight.</p>
  
  <p>If I try</p>
  
  <pre><code>start onResume
  
  if (service is running?)
      show progress dialog
      while the service is running, thread.sleep
      dismiss progress dialog
  
  end onResume
  </code></pre>
  
  <p>The thread sleeps fine and wakes up great. But the damn progress dialog doesn't show till onResume...resumes! Bottom line, how do I show an indicator (progressdialog or dialog) before I put the main thread to sleep?</p>
  
  <p>I'm open to solutions that load another activity till the service resumes. I've tried that, but the previous activity continues on happily :|</p>