Android Splash Screen With Progress Bar

A splash screen is a graphical control element consisting of window containing an image,  logo and the current version of the software. Splash screen usually appears while a game or program is launching. A Splash screened are typically used by particularly large applications to notify the user that the program is in the process of loading. They provide feedback that a lengthy process is underway. Occasionally, a progress bar within the splash screen indicates the loading progress. The splash disappears when the application’s main window appears. Source: Wikipedia. Else we can use it for making the app more attractive. You can find tutorials in splash screen for android all over the internet. Only few that works without the blank screen while launching. I found a perfect example for proper splash screen from bignerdranch.com.

splash screen logicchip thumb

Progress bar is used in this example and can be changed according to the work done. We are creating two activity’s. One for displaying flash and another is the landing activity. The page after splash screen. This can be explained in four steps.

  1. Creating the xml file for the splash screen.
  2.  Creating the theme for splash activity.
  3. Applying the theme for splash activity.
  4. Background tasks to be done while displaying progress bar and splash screen.

 

 

Fourth one is for class files to show progress and load next page after progress bar reach 100% .




splash screen logicchip image 1

 1 – Creating XML file for the splash screen and splash activity

For this first create a xml file in the drawable. Mine is "splash.xml",ic_launcher is the splash image.

Below is the xml file for Splash activity.




2 – Creating the Theme for splash activity

Theme is an important element. Edit your styles.xml file and add the SplashTheme part.

3 – Applying the theme for splash activity

Setting theme for the specified splash activity. Just edit AndroidManifest.xml file and replace the laucher activity theme with SplashTheme.

4 – Tasks for progress bar and loading next activity

Two activity’s are created Splash.java and MainActivity.java. Splash.java is the splash activity,handling the splash and progress of progress bar. MainActivity.java is the landing page. Inside the code the part runOnUiThread  is used to modify the TextView component. Ui components modification is possible only on ui thread. Otherwise app crashes.

Time period is set to 100 ms. Run method inside the thread executes every 100 ms. It only stops when timer.cancel(); called . If you don’t call timer.cancel(); the process continues to execute leading to system hang or crash.

You can download full code from here, You can modify the code us u like. In like manner feel free to comment your doubt’s below. Does our tutorials help you then help as spread the word, like and share.

4 thoughts on “Android Splash Screen With Progress Bar

Leave a Reply

%d bloggers like this: