title: Make AlertDialog in AsyncTask onPreExecute stop doInBackground until it is dismissed
body: <p>Is there any way to prevent the doInBackground method/thread of an AsyncTask from starting until an AlertDialog which is displayed during the onPreExecute method has been dismissed?</p>
  
  <p>doInBackground is only meant to run when onPreExecute completes, however as far as I can tell, having an open AlertDialog does not stop onPreExecute from completing.</p>
  
  <p>Details:
  Am on my phone at the moment so can't give code sample, but the overview of the code is that it's an app that requires data that can only be accessed via mobile data due to being on telco network.  The preExec of my getData asynctask first checks if wifi is up, and if so displays an alert dialog with Disable Wifi and Cancel options.</p>
  
  <p>Cancel should end the task, and Disable Wifi should, well, disable wifi.  doInBg method then checks if mobile data connection is up, and if not goes into a sleep loop unti it is.  Once it is up, doInBg then gets the data...</p>
  
  <p>Currently, if wifi is on doInBg starts before the dialog is dismissed, getting trapped in the sleep loop until something causes mobile connection to come up... This leads to potential problems I'd like to avoid.</p>