How to implement android flash screen

Implement Android Splash Screen

android, TUTORIALS

How to implement Android Splash Screen

Welcome Everyone to another fun tutorial in android basics. In this tutorial How to implement Android Splash Screen we gonna teach you how to implement the android splash screen for your android application. In general the splash screen is nothing but, before start our application starts it shows an welcome screen like company or application logo for a while period. To implement a splash screen basically we need two activity screens. One is our Main Acitivity and another one is our splash screen activity. Unluckily we don't have any pre-defined mechanism for this feature like in iOS. So, Lets Get Started.

Android Splash Screen Using Timer

Here we using timer for implement android splash screen activity.

implement android splash 

Create a new File - (Implement android splash screen)

implement android splash screen

Choose an Correct API Version - (Implement android splash screen)

implement android splash screen

Template selection for our activity (Implement android splash screen)

implement android splash screen

Give a Name to our activity - Default is MainActivity (Implement android splash screen)
2. To create a Splash Screen we've to create a new activity from the file menu. Following is the procedure to create new activity. Just go to File -> New -> Activity -> Blank Activity. And then just go with next and finish to create a fresh activity.
implement android splash screen
Create Blank Activity - (Implement android splash screen)
implement android splash screen
Name to the second Activity as SplashScreen - (Implement android splash screen)
3. The next step is more important to make a screen as first in the app. Open your Manifest file and change your content_splash_screen as launcher actitvity.


<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android=""
package="com.example.androidhotspot.splashscreen" >
android:theme="@style/AppTheme" >
android:theme="@style/AppTheme.NoActionBar" >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
android:theme="@style/AppTheme.NoActionBar" >
4. When create a new activity, the android studio automaticaly creates two files under the res -> layout folder, and an activity java file. After confirm whether the above files are placed on their locations open content_splash_screen.xml to design our splash screen. And modify your content_splash_screen.xml like the file below. Copy and paste the below code into your splash_screen.xml.


<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android=""
android:src="@drawable/logo1" />
android:id="@+id/textView" />
After adding the code go to Design tab in the content_splash_screen.xml and the output design should be look like this. If you don't have your own logo image just download it from here(Logo Image Link).

implement android splash screen

Expected design of the splashscreen.xml - (Implement android splash screen)
5. Completing the design part let's move to the brain part of the how to implement the Android splash screen. In this tutorial our main target is not the instead we use the because we mention this is the launcher for the application.
The main concept in this How to implement Android Splash Screen application is slow down the showing process of the single activity in an application. For that we use postDelayed method from the Handler class. When you choose the handler it shows the two handler classes, one is normal Java handling class and another one is Android handler. From these two options we've decide for our how to implement the Android splash screen application Android Handler. It also automatically implements an method called run().

package com.example.androidhotspot.splashscreen;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
public class SplashScreen extends AppCompatActivity {
private static int SPLASH_TIME_OUT = 4000;
protected void onCreate(Bundle savedInstanceState) {
new Handler().postDelayed(new Runnable() {
public void run() {
Intent intent = new Intent(SplashScreen.this, MainActivity.class);
After complete the coding run the application from the menu bar, you will see the Splash screen for 4 seconds and then our MainActivity is launched.

implement android splash screen

In this How to implement Android Splash Screen lesson Splash Screen for the first four seconds of our app - (Implement android splash screen)
In this how to implement the Android splash screen tutorial we didn't change any codes in MainActivity.Java because we don't need to modify that for this stuff. If you want add something in MainActivity you can add in the .java file.

implement android splash screen

The home Screen of our App after the Splash Screen - (Implement android splash screen)

Leave a Reply