Android Splash Screen Example

In this post, we will see how to create Android splash screen.
Android splash screen is nothing but screen that appears when some background task (such as fetching data from database,loading images) is going on. These kind of task generally tasks long and at that time, we can show splash screen. Splash screen can be app icon, company logo , punch line. Once background task completes, another activity will get called.
For example:
When Xender app loads, you will see screen as below.

Xender App

Source code:

Lets create Android splash screen example:

Step 1 :Creating Project

Create an android application project named “SplashScreenExampleApp”.

Step 2: Put any image in drawable folder with name “splash_logo”

Step 3 : Creating splash screen layout file

  • Go to res -> layout
  • Right click on layout
  • Click on New -> File.
  • Create a file named “splash_screen.xml” and paste below code in splash_screen.xml.

Step 4: Create SplashActivity

Create SplashActivity as above. We are creating a new thread and calling sleep for 10 secs on it. In real time, this will be replaced by actually task that will be performed such as fetching data from database or loading images.

Step 5 : Creating Layout

Change res ->layout -> activity_main.xml as below:

Step 6 : Creating MainActivity

Change src/main/packageName/MainActivity.java as below:

It is default MainActivity provided by HelloWorld app.

Step 7 : Changing AndroidManifest.xml

We need to put launcher activity as SplashActivity, so we need to do following changes in app -> src -> main -> AndroidManifest.xml as below:

Step 7 : Running the app

When you run the app, you will get below screen:

Android Splash Screen tutorial

After 10 secs, you will get below screen:

Android Splash Screen Example

Join Our Newsletter

Subscribe to Awesome Java Content

Add Comment

Join Our Newsletter

Subscribe to Awesome Java Content