Android splash screen are normally used to show user some kind of progress before the app loads completely. Some people uses splash screen just to show case their app / company logo for a couple of second. Unfortunately in android we don’t have any inbuilt mechanism to show splash screen compared to iOS. In this tutorial we are going to learn how to implement splash screen in your android application.

Download Code
This image is for thumbnail purpose only
android splash screen

Splash screen use case scenarios

The purpose of splash screen depends upon the app requirement. Check out the following diagram which gives explanation about two use case scenarios.

android splash screen use case scenarios

In this tutorial I’ll be covering implementation of splash screen in two scenarios. One is showing splash screen using a timer and second is showing splash screen when making network http calls which takes some time to fetch required information. Both the tutorial are same except the splash screen activity.

In order to implement splash screen we are going to create a separate activity for splash and once it closes we launch our main activity.

So let’s get started by creating a new project

1. Android Splash Screen Using Timer

1. Create a new project in Eclipse by navigating to File ⇒ New Android ⇒ Application Project and fill required details. (I kept my main activity name as

2. For Splash Screen we are creating a separate activity. Create a new class in your package and name it as

3. Open your your AndroidManifest.xml file and make your splash screen activity as Launcher activity.

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android=""
    android:versionName="1.0" >

        android:targetSdkVersion="17" />

        android:theme="@style/AppTheme" >
        <!-- Splash screen -->
            android:theme="@android:style/Theme.Black.NoTitleBar" >
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
        <!-- Main activity -->
            android:label="@string/app_name" >


4. Create a layout file for splash screen under res ⇒ layout folder. I named the layout file as activity_splash.xml. This layout normally contains your app logo or company logo.

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android=""
    android:background="@drawable/gradient_background" >

        android:src="@drawable/wwe_logo" />

        android:text="" />


5. Add the following code in activity. In this following code a handler is used to wait for specific time and once the timer is out we launched main activity.

package info.androidhive.androidsplashscreentimer;

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

public class SplashScreen extends Activity {

	// Splash screen timer
	private static int SPLASH_TIME_OUT = 3000;

	protected void onCreate(Bundle savedInstanceState) {

		new Handler().postDelayed(new Runnable() {

			 * Showing splash screen with a timer. This will be useful when you
			 * want to show case your app logo / company

			public void run() {
				// This method will be executed once the timer is over
				// Start your app main activity
				Intent i = new Intent(SplashScreen.this, MainActivity.class);

				// close this activity


android splash screen output

Run the application, you will see the splash screen for 3 sec and then your main activity will be launched.

Following is the second scenario where our app is going to make some network calls before entering into app. Here every thing is same as previous case except the code. In splash screen activity in onCreate method we will calls a AsyncTask method which fetch required information by making http call. Once the http call terminates we launch main activity in onPostExecute() method.

2. Android Splash Screen When Making Network (http) Calls

1. Follow the same steps as above until creation of

2. After that the first step is add INTERNET permission in the manifest file as this app going to use internet. Open your AndroidManifest.xml file and add INTERNET permission above <application> tag

<uses-permission android:name="android.permission.INTERNET"/>

3. Open your and add AsyncTask to make http calls. In this tutorial i am making an http call to get json and displayed on the log in screen. After fetching the json the data will be sent to using Intents.

Following is the json i am going to fetch. You can access this json from

		"now_playing" : "49500",
		"earned" : "$65000"

Paste the following code in

package info.androidhive.androidsplashscreentimer;

import info.androidhive.androidsplashscreennetwork.R;

import org.json.JSONException;
import org.json.JSONObject;

import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;

public class SplashScreen extends Activity {

	String now_playing, earned;

	protected void onCreate(Bundle savedInstanceState) {

		 * Showing splashscreen while making network calls to download necessary
		 * data before launching the app Will use AsyncTask to make http call
		new PrefetchData().execute();


	 * Async Task to make http call
	private class PrefetchData extends AsyncTask<Void, Void, Void> {

		protected void onPreExecute() {
			// before making http calls			


		protected Void doInBackground(Void... arg0) {
			 * Will make http call here This call will download required data
			 * before launching the app 
			 * example: 
			 * 1. Downloading and storing in SQLite 
			 * 2. Downloading images 
			 * 3. Fetching and parsing the xml / json 
			 * 4. Sending device information to server 
			 * 5. etc.,
			JsonParser jsonParser = new JsonParser();
			String json = jsonParser

			Log.e("Response: ", "> " + json);

			if (json != null) {
				try {
					JSONObject jObj = new JSONObject(json)
					now_playing = jObj.getString("now_playing");
					earned = jObj.getString("earned");

					Log.e("JSON", "> " + now_playing + earned);

				} catch (JSONException e) {
					// TODO Auto-generated catch block


			return null;

		protected void onPostExecute(Void result) {
			// After completing http call
			// will close this activity and lauch main activity
			Intent i = new Intent(SplashScreen.this, MainActivity.class);
			i.putExtra("now_playing", now_playing);
			i.putExtra("earned", earned);

			// close this activity



4. On your take appropriate action using parsed json data. I just displayed on log in screen.

package info.androidhive.androidsplashscreentimer;

import info.androidhive.androidsplashscreennetwork.R;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

public class MainActivity extends Activity {

	LinearLayout llStats;
	TextView txtPlayCount, txtEarned;

	protected void onCreate(Bundle savedInstanceState) {

		llStats = (LinearLayout) findViewById(;
		txtPlayCount = (TextView) findViewById(;
		txtEarned = (TextView) findViewById(;

		// layout background transparent

		Intent i = getIntent();
		String now_playing = i.getStringExtra("now_playing");
		String earned = i.getStringExtra("earned");

		// Diplaying the text

android splash screen when making http

I provided two separate project in the source code of this tutorial, download and go through the code to get clear picture of the concept.

Hi there! I am Founder at androidhive and programming enthusiast. My skills includes Android, iOS, PHP, Ruby on Rails and lot more. If you have any idea that you would want me to develop? Let’s talk:
  • nickjhonatam

    Taking advantage of the opportunity, as I do so that at the same time it is loaded, for example; I extend to 5 seconds the splash to your view, and the url load in the background? So when the splash finished being displayed the site was already loaded at the time of the splash transition and webview.

    Do you have any tutorials like that?

    • You can use WebView pagLoaded callback to achieve this. Hide the Splash screen when the page loaded callback is called instead of 5 second. Also the Splash Screen and WebView has to be implemented in the same activity.

  • Pin

    hi, what’s the image size of the splash screen image? thanks!

  • Bryan Fury

    Hi, I used the first splash method, works thanks. However, if user hits back button and open app again, it shows again. How to show it only if app is closed also from background and opening app again ?

    • After you main activity launched call finish() in Splash activity.

      Intent i = new Intent(SplashScreen.this, MainActivity.class);

      // close this activity

  • Jagdeep Singh

    Where is JsonParser Class??

  • Dhaarini Guns

    How do I make use of the libs of below?
    import info.androidhive.androidsplashscreennetwork.R;

    I am getting error on trying to use these.
    Thank you..

    • Meng si

      Use your own package name

  • Machhindra Sudke

    how we write activity_main file for this example..

  • Pasan Ranathunga

    short n simple one thanks

    • you are welcome 🙂

      • Gwun-orene Rufus Ezekiel

        Mr. Ravi, i am working on an app that can send video, pictures, map, and other details of a report, through email, twitter, facebook, and notifications, please i will need your assistance.

        Whatsapp >+2348086080593, +2347038843102

  • saurabh

    this is not working with navigation drawer

  • saurabh

    this is not working with navigation drawer please give me best solutions

    • Splash Screen doesn’t need Navigation Drawer right? Whats the problem?

    • zohar

      splashScreenActivity would be the first activity, after displaying it for a few seconds you can start your mainActivity with the navigation drawer.

  • enthusiast

    Does google allow you to include ads on a splash screen?

    • faris muhammed


  • Pragadeesh Kanagavel

    Use handler.removeCallbacksAndMessages in on back pressed callback to avoid home activity popping up after splash screen is destroyed.

  • nexmobile developer

    I want to show alertDialog for on GPS Location in Splash Screen. how to do this.

  • Iqra Rajput


  • Kuldeep Kumar

    hi sir how to read data in sqlite from this url

  • Ashish Sharma l
    How can i place the text over the image in backround and decrease the opacity of image