Progress dialog during tab switch
<p>When the user switches from tab A to tab B it takes a long time (6 seconds), so I put in a progress dialog to let the user know that the app is working on it.  The timeline is as follows:</p>

<ol>
<li>Activity B onCreate - creates ProgressDialog and puts long tasks in a background Thread.</li>
<li>Activity B onStart</li>
<li>Activity B onResume</li>
<li>Activity B appears on the screen</li>
</ol>

<p>This all works great with one "minor" snafu- the app intermittently crashes because the onResume function references something that is created by the background Thread.  It is, in other words, a classic race condition.</p>

<p>To fix the race condition I did a "join" on the thread right before the reference in onResume, but that makes the progress dialog not show up until the background thread is done (i.e. it shows up for a split second and then goes away) and the app acts like it is hung while the background thread is working.  Apparently the progress dialog cannot show up until onResume completes.</p>

<p>My question is this: how can I get the ProgressDialog to show up without crashing the program?  Or do I need to either get the offending reference out of onResume or live with the app acting hung?</p>
