And pay close attention to when you are in which thread. Also the
suggestion of a splash screen is a good one, since you don't want to
let the user input data your program is not ready for.

As for keeping track of when you are in which thread, the following
table I derived while reading the online docs for AsyncTask might
help:

UI Thread                       Worker Thread

1) execute()
1) onPreExecute() (automatically foll execute())


2)                               doInBackground(Params) (result of
call to execute())
2a)                              publishProgress() (optional, but good
idea)

3) onProgressUpdate() (resp. 2 publishProgress)

4) onPostExecute(Result)  (system calls ths, but is on UI thread)


Just in case the formatting gets messed up, the above is supposed to
appear as two columns: one for things taking place in the UI (main)
thread, the other for the background = 'worker' thread.

On Sep 22, 10:39 am, TreKing <[email protected]> wrote:
> On Wed, Sep 22, 2010 at 12:24 PM, Kakyoin <[email protected]> wrote:
> > But it doesn't work. The screen goes black for the same amount of time even
> > after I use the progress dialog.
>
> You probably used the dialog in the main thread, which won't make a
> difference.
>
> Look at AsyncTask.
>
> -------------------------------------------------------------------------------------------------
> TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago
> transit tracking app for Android-powered devices

-- 
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

Reply via email to