Splash Screen - Androhub

Splash Screen

Splash Screen

What is Splash?

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.

Splash screen use case scenarios

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

  • Use Splash Screen to show app logo , it uses a timer to dismiss.
  • Show Splash Screen when making network calls (http) / preparing app.
  • Downloading Images.
  • Fetching and parsing Json/ XML.

In this tutorial I’ll be covering implementation of splash screen using a timer .

 

VIDEO DEMO

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 MainActivity.java)

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

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

4. Create a layout file for splash screen under res ⇒ layout folder. I named the layout file as splash.xml. This layout normally contains your app logo or company logo. You can paste your image/logo under res ⇒ drawable folder and set it to background to the layout.

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

6. Create a layout file for main activity under res ⇒ layout folder. I named the layout file as activity_main.xml.

7. Add the following code in MainActivity.java activity. In this following code we just set view over this activity.

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

splash
second_activity

 

Thanks 🙂

 

Post comment

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