android splash screen/ loading screen

14,870

Solution 1

Would it be ok if i had it in a different thread maybe?

In android, when we build an application we may need to display a splash screen ( welcome screen ) for users to intimate some thing & do some other process in background ( like fetching data from DB, Parsing XML , etc.. ), so for that it is preferrable to implement it in a different thread.

I have referred the example on www.androidpeople.com site for the SPLASH SCREEN, you may also Have a look at this example of SPLASH SCREEN .

Solution 2

You want a separate thread to execute tasks in background, while showing progress in the foreground and call the setVisibility(...) method you say after doing so.

I've come across this tutorial: http://www.41post.com/4588/programming/android-coding-a-loading-screen-part-1

I've found it excellent, it's easy to implement, only one class and after part 2 you learn how to really get rid of the AsyncTask definitevely (http://stackoverflow.com/questions/3077461/asynctask-threads-never-die-android).

Share:
14,870
jfisk
Author by

jfisk

Updated on June 04, 2022

Comments

  • jfisk
    jfisk almost 2 years

    I have a splash screen/loading screen that has .setVisibility() to GONE right after the draw call of my large bitmap is completed. The problem is the splash screen takes a bit to popup which i believe is due to the main activity booting up and doing CPU intensive applications on first run. Is there a way to get my splash screen displayed ASAP? Would it be ok if i had it in a different thread maybe? The splash screen is just a bitmap with a progressBar right below it. My layout is xml based so i cant see myself using setContentView. Thanks.

  • SolessChong
    SolessChong almost 11 years
    After reviewing the code, may I ask if this code do other process in backgroud?
  • SolessChong
    SolessChong almost 11 years
    I meant, your solution works fine for creating a splash screen. However, in my scenario, where I'm trying to load a webview in the MainActivity, it might not work, because the code seems to initialize the MainActivity only after the splash time expires.