Create Splash Screen Activity on your Android App

Create Splash Screen Activity on your Android App

In this tutorial, I like to share the simple and useful tutorial for How to create Splash Screen Activity on your android app, In today’s Android app developers mostly using this option to show the company logo and it’s slogan for the created app.

It will help to easily attract the app users to show its company quality as well as it’s popularity on the main splash screen activity on it’s Android app.

Why use Splash Screen on your android application:

  1. Show the company logo and its slogan.
  2. To load the data from the database to show the main activity, because the data will load to take some time, so the app developer using this splash screen option to matching the database loading time at the backend.
  3. While using the splash screen on your application, it gives the one more plus point for you to attract the app user.

Steps to create Splash Screen Activity on your android app :

Step 1: In this project I am using the Android studio 1.5  to create this app, Start the android studio launch icon on your desktop and choose the start a new project option , while click on the option it will show the new popup window for adding the application name, company name, package name as well as the storage location path of your android application, Check the below image for your better clarification.

Splash Screen ActivityStep 2: Then click on the next to choose the platform and minimum SDK , I am choosing the minimum SDK as API 15: Android 4.0.3 ice cream sandwich, then click to next, here you will choose the blank activity and proceed next to click finish, Check the below image for better understanding to how to done this !!!

Splash Screen Activity

Step 3: Once the project successfully created and grade will be build successfully means go to the app section at the top of the screen, click on that it will show the three more options such as manifests, java, and res.

click on the java folder it will show the package file com.techinfoworld.splashscreen click right click on that to choose the new option and select the Java Class  (( com.techinfoworld.splashscreen —-> right click —-> New —-> Java Class )). It will show the new popup window here you will type it as SplashActivity without spaces and click ok !!,

Splash Screen Activity

Step 4: In this SplashActivity.java copy the below code and paste it.

(Important Note: check the package name, copy the code below the import package name.)

package com.techinfoworld.splashscreen;
/**
* Created by Anto Navis on 9/6/2016.
*/
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
public class SplashActivity extends Activity {
// Splash screen timer
private static int SPLASH_TIME_OUT = 3000;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
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
*/
@Override
public void run() {
// This method will be executed once the timer is over
// Start your app main activity
Intent i = new Intent(SplashActivity.this, MainActivity.class);
startActivity(i);
// close this activity
finish();
}
}, SPLASH_TIME_OUT);
}
}

Step 5: Then goes to res folder and choose the layout, right click on the new and choose the layout resource file option, (( res —> New —-> Layout Resource File)). It will show the new popup window here you will type it as activity_splash without spaces, using small letter and click ok !!

Splash Screen Activity

Step 6: In this activity_splash.xml copy the below code and paste it.

(Important Note: check the package name, copy the code below the import package name. and also add logo image with the name of the logo in the drawable folder)

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#3d3d3d" >
<ImageView
android:id="@+id/Logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/logo"
android:layout_above="@+id/textView"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="193dp"
android:gravity="center_horizontal"
android:text="Tech Info World"
android:textColor="#ffa000"
android:textSize="28sp"
android:id="@+id/textView"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="India's No:1 Technology Website"
android:textColor="#009dff"
android:textSize="25sp"
android:id="@+id/textView2"
android:layout_marginTop="67dp"
android:layout_alignTop="@+id/textView"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="* Born to Win *"
android:textColor="#fff"
android:textSize="25sp"
android:id="@+id/textView3"
android:layout_below="@+id/textView2"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginTop="35dp" />
</RelativeLayout>

Step 7: Then Finally Goes to the Manifests folder and choose the AndroidManifest.xml copy the below code and paste it.

(Important Note: check the package name, copy the code below the import package name.)

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.techinfoworld.splashscreen">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<!-- SplashActivity -->
<activity
android:name=".SplashActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>

Step 8: Last and final important step is to change the styles.xml file section, DarkActionBar to NoActionBar, if you didn’t change the theme means, splash screen will show the app name toolbar at the top of the screen. so you must change the theme.

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">

Step 9: Finally build the project and run it, Once you run your android splash screen application, it will show splash screen for 3 secs and show the main activity of your splash screen after 3 secs.

Step 10: Check the output sample of the above Splash Screen Activity application. I hope you understand the simple option to create the splash screen for your android application.

Splash Screen Activity

Conclusion :

I hope in this tutorial is very useful for all the android app beginner developers to easily understand the concept and execute it. Sharing is wealth, Kindly share this post to all. Keep staying tuned to learn more android application creation tips and much more wonderful technologies.

Comments (1)

Leave a Reply

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

181 Shares
Share79
Tweet
+1
Share1
Pin100
Stumble1