Splash Screen In Android – The Complete Beginner Guide (2020)

Adroid Splash Screen Tutorial
Share your knowledge.
Hello Everyone, In this tutorial blog you will learn “What is splash screen in android? and how to create one?” I try to cover everything you need to know about the splash screen.
 
This is a complete beginner guide for creating the android splash screen. Feel free to jump to the section that you want to read from the table of contents

A splash screen is just an activity in android which the user see it first as soon as the app is launched. Generally a splash screen appears for specific period of times i.e for 3 seconds to 5 Seconds.

2. How Splash Screen Is Different From Other Screens ?

Well there are quite differences in splash screen and other screens in the task that they perform some of them which I think notable are listed below here 

  • Splash screen is the first screen that the user see if a app has one. But other activities or screens or not the first screen
  • Splash Screen runs for specific period of time whereas other screen may not run for specific time
  • Splash Screen is simple in nature i.e there will be nothing for user to do in splash screen except just watching it and it also doesn’t contain any buttons generally 
  • Splash Screen finishes as soon as it moves to next activity and there is no coming back to it until next  launch

3. Implementing Splash Screen In Android

There are mainly two ways to create a splash screen in android 

  1. Using Handlers
  2. Using Threads 

Let us discuss them one by one

a. Implementing Splash Screen In Android Using Handler

Handler will allow us to schedule messages and runnables to be executed at some point in the future time and also to enqueue an action to be performed on a different thread of our own. 

A runnable is interface. whichever class implements it, that class must override run(), in that run() code that perform necessary task must be written

Sample Code Using Handler

b. Implementing Splash Screen In Android Using Threads

Thread can be called as a light weight process. It will also have a run() but to start a thread we need to call start() on thread object. As soon as a thread starts it will start executing the code inside run() where in Handlers the code written in run() will be started after some delay

Sample Code Using Thread

4. Step By Step Implementation of Splash Screen

Fallow these steps to create splash screen 

Step 1 : Setting Up The Project

Create a new android project in android studio and give the name whichever you prefer and create 2 empty activities called SplashScreen and MainActivity (by default MainActivity will created automatically so just create a SplashScreen activity)

 Your project structure should look something like in the image 

Project Directory

Step 2 : Designing the Splash Screen Activity

Now open the activity_splash_screen.xml and design it. If you are a complete beginner then you can just paste the code below.

You may get error because of not having the image so just replace it with any other image 

activity_splash_screen.xml

Step 3 : Coding Splash Screen

Now open the SplashScreen.java and paste the code below. I used 1st method that is using handlers. This code will start the MainActivity after 3 seconds 

SplashScreen.java

Step 4 : Updating Manifest File

Now we need to make sure that our Splash Screen Activity set as launcher activity in the manifest file and also we don’t want to display the toolbar in Splash Screen we can fix these two things in manifest file.

Open the AndroidManifest.xml and under the Splash Screen activity tag create the intent filter add main action and category as launcher. And remove intent filter tag if MainActivity tag has one with launcher and main tag and set theme to @style/Theme.AppCompat.NoActionBar

Your AndroidManifest.xml should look something like this 

AndroidManifest.xml

Step 5 : Run the app

Now our app should run perfectly without any issues. It should look something like this. It may look different on your device since I used different colors and images 

5. Final Words

That’s all about the Splash Screen you can download the whole source code from below and work on it. If you have any doubts regarding this feel free to ask them in the comments below.

Bonus : Some Design Tips To Consider While Making Splash Screen

Whenever you are creating Splash Screen or any other screen you must consider material design guidelines. Some of the tips that I can give you for this is 

  1. Don’t make splash screen time too long 
  2. Keep Splash Screen simple. Only use app icon and app name 
  3. If possible add animation to the elements present in splash screen 
  4. You can also use splash screen to make some checks like network availability, some other checks based on that you can move user to different screens 

For More design tips visit Material Design Guidelines for Launch Screen

Project Source Code

You can download the source code by clicking this button 

I am the guy responsible to make sure that everything that goes through this website has some value and gives some knowledge to the visitors. I have the habit of collecting quotes and I can't imagine my life without programming. I believe in self-education.
Posts created 4

Leave a Reply

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

Related Posts

Begin typing your search term above and press enter to search. Press ESC to cancel.