Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android application loading screen

Tags:

android

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!

like image 254
Ljdawson Avatar asked Oct 20 '09 20:10

Ljdawson


1 Answers

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.

like image 124
CommonsWare Avatar answered Oct 21 '22 23:10

CommonsWare