Open In App
Related Articles

Android | Creating a Splash Screen

Like Article
Save Article
Report issue

A splash screen is mostly the first screen of the app when it is opened. It is a constant screen which appears for a specific amount of time, generally shows for the first time when the app is launched. The Splash screen is used to display some basic introductory information such as the company logo, content, etc just before the app loads completely.

Creating Splash screen using handler in Android

Here we created two activities MainActivity showing the Splash Screen and SecondActivity in order to switch from MainActivity to SecondActivity. The main program is written in MainActivity, you can change activities as per your need.

  • To remove the ActionBar, you need to make following changes in your styles.xml file.
style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"
  • Use colors which is suitable for your application.
  • No need to make any changes in your manifest file.


package com.example.hp.splashscreen;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.WindowManager;
public class MainActivity extends AppCompatActivity {
    private static final int SPLASH_SCREEN_TIME_OUT = 2000; // After completion of 2000 ms, the next activity will get started.
    protected void onCreate(Bundle savedInstanceState) {
        // This method is used so that your splash activity can cover the entire screen.
        setContentView(R.layout.activity_main); // this will bind your MainActivity.class file with activity_main.
        new Handler().postDelayed(new Runnable() {
            public void run() {
                // Intent is used to switch from one activity to another.
                Intent i = new Intent(MainActivity.this, SecondActivity.class);
                startActivity(i); // invoke the SecondActivity.
                finish(); // the current activity will get finished.


Last Updated : 19 Jan, 2023
Like Article
Save Article
Share your thoughts in the comments
Similar Reads