After some trouble figuring out how values are passed into the private class that extends AsyncTask (which, while compact, has a somewhat tricky syntax--at least for me), mine works the way it should. Thanks!
On Mar 11, 4:00 pm, Kostya Vasilyev <[email protected]> wrote: > 12.03.2011 0:31, David Williams пишет: > > > Does Java do certain things asynchronously then? I was thinking that > > things were done in a serial fashion but perhaps that is not the case. > > ProgressDialog.show is asynchronous, just like may other UI operations. > > Normally, this works, because the Android UI toolkit, just like many > others (and not just for Java) is built around the "event loop" or > "message loop" concept. The main thread runs in an infinite loop for > processing messages, one at a time. Each message is a small task: this > can include, for example, showing a dialog, redrawing a view, calling > one of the application's callback methods. > > Your code: > > - Called by Android in onCreate > - Calls setContentView > - Calls ProgressDialog.show > - Fetches stuff from the Internet > - Returns from onCreate > > All of the above happens on the UI thread, which waits for your onCreate > to return before proceeding to the next message (== "small task"). > > What your code in onCreate should do: > > - Call setContentView > - Call ProgressDialog.show > - Start an asynchronous operation to fetch stuff from the Internet > - Return from onCreate > - [ Android processes queued-up operations: draws your activity, shows > the dialog ] > > The asynchronous fetch then should: > > - Run on its own thread; > - When done, "tell" the application to hide the progress dialog and proceed. > > Hopefully, it starts to make more sense as you read through the links > I've provided. > > This is probably the easiest way to implement asynchronous operations: > > http://developer.android.com/reference/android/os/AsyncTask.html > > -- > Kostya Vasilyev --http://kmansoft.wordpress.com -- 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

