Aswin Balaji

Aswin Balaji

186 Sadasivam Nagar,Madipakkam,Chennai, TN 600091
Aswin Balaji

Android Splash Screen

August 17, 2015, by Aswin Balaji, category ANDROID
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 asactivity_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
        }, SPLASH_TIME_OUT);

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