Android: How to Update in Background and Provide an Optional Progress Bar
<p>My app needs to download large xml files in the background and then use them to update a database.  I would like these updates to happen automatically in the background, without bothering the user.  This part seems easy and it seems like AsyncTask is what I'd use here.</p>

<p>However, I also want to provide a way for the user to:<br>
1)  Manually start an update if and only if the app is not already updating<br>
2)  View the status of an update already in progress</p>

<p>Here is the flow of the app as I see it now:<br>
1)  App is launched, main Activity is started<br>
2)  AsyncTask is automatically started by main Activity to update app<br>
3)  User selects "Update" from main menu<br>
4)  User is presented with the Update Activity<br>
5)  If update is going on in background:<br>
--5A)  User sees a Progress Bar<br>
--5B)  Otherwise, user sees option to start update</p>

<p>I think step 4 to 5 is where my main problem is.  The Update Activity is a new Activity, different than the main Activity.  I don't know how to access the AsyncTask from the Update Activity.</p>

<p>In other words, I start AsyncTask in one Activity, but I only want AsyncTask to display its progress in a second Activity, which may be open and closed at any time.</p>

<p>Some options I've been exploring include Service and BroadcastReceiver, but I don't know enough about either to make a good decision.</p>

<p>Thanks for your help.</p>
