Thanks Mark, but I'm not sure if that will work in this case. I have the user press a button that invokes Asynctask to retrieve data from the hardware.
The user is then asked to press a second button to retrieve alternate data from the hardware. If the user presses the second button before the first call to Asynctask returns, then the data will not be complete. I hope this makes sense. Any ideas for this scenario? Thanks, Stephen On Jul 6, 10:23 am, Mark Murphy <[email protected]> wrote: > On Tue, Jul 6, 2010 at 12:57 PM, Stephen Lebed <[email protected]> wrote: > > I'm calling an AsyncTask in my UI thread from a button click. The > > AsyncTask is collecting data from the hardware sensors, and will store > > the info into global variables that I'll perform work from. > > "global variables" = ick. > > > I'd like > > to know how to either wait for the AsyncTask to finish without locking > > up the UI, or how to trigger an event when AsyncTask is finished. > > Override onPostExecute() in the AsyncTask and do your work there. In > fact, why not get rid of the "global variables", hold onto the data in > the AsyncTask, and just apply them in onPostExecute()? > > -- > Mark Murphy (a Commons > Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy > > Android Development Wiki:http://wiki.andmob.org -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

