AndroidAndroid UI

Create Splash Screen In Android

What Is A Splash Screen?

Splash screen is the initial screen when user opens the app. It basically contains branding items like logo, slogan and company name etc. It also known as the boot screen. If you want to execute a long task and get the result to show as the content of the next page then Splash screen is the best place to execute that long running task.

See the picture below, is an example of what the DropBox splash screen for Android that appears when the app is opening.

In this tutorial i will show you how to create a simple splash screen that waits for 5 seconds before it automatically navigates to the next page.

Step 1: Create A Layout XML file

Create a layout res/layout/activity_splash.xml

Add a TextView with text “Please wait …”. Which will be the indicator for the viewers that the app is still responding.

Step 2: Create SplashActivity Class

import android.content.Intent;
import android.os.Handler;
import android.os.Bundle;

public class SplashActivity extends Activity {
    private Handler mWaitHandler = new Handler();

    protected void onCreate(Bundle savedInstanceState) {

        mWaitHandler.postDelayed(new Runnable() {

            public void run() {

                //The following code will execute after the 5 seconds.

                try {

                    //Go to next page i.e, start the next activity.
                    Intent intent = new Intent(getApplicationContext(), NextActivity.class);

                    //Let's Finish Splash Activity since we don't want to show this when user press back button.
                } catch (Exception ignored) {
        }, 5000);  // Give a 5 seconds delay.

    public void onDestroy() {
        //Remove all the callbacks otherwise navigation will execute even after activity is killed or closed. 

Step 3: Add Activity In Manifest

Finally Set Splash activity as the first page when app opens.


                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />

Good luck!

About author

Rojer is a programmer by profession, but he likes to research new things and is also interested in writing. Devdeeds is his blog, where he writes all the blog posts related to technology, gadgets, mobile apps, games, and related content.

Leave a Reply

Your email address will not be published. Required fields are marked *