tags:

views:

1522

answers:

2

Hi everyone, I'm working on an application that lists a stored library using a ListActivity.

My question is, is when I open application it has a visible loading time before the XML view is inflated. During this time only the application name is shown. This is noticeable on quite a few application out there but others seem to have implemented loading screens and what not.

Does anyone have a solution to this or know how to make a good loading screen?

Cheers!

+6  A: 

If your activity is taking more than a couple of tenths of a second to start up, you are doing too much work in onCreate(), onStart(), or onResume(). Move that work to a background thread, perhaps using AsyncTask.

Then, if you want to do something while the background thread is crunching away, you can use a ProgressDialog, or call setContentView() multiple times (initially with a splash screen, then later with the full UI once the background work is done), or whatever.

CommonsWare
Thanks! This helped a lot.
Laurence Dawson
+2  A: 

do your job in AsyncTask and use android.widget.ViewSwitcher for UI. You can switch between two views. Show one view when you start your job(some "Loading" View) and switch to "normal" when job is done.

ponkin