Launch App via Splash Screen

Android: Perfect Way to Create Splash Screen

Anurag Dhunna
Viithiisys

--

Splash Screen is often referred to a welcome screen or user’s first experience of an application. There are many ways for creating a Splash Screen for an Android Application.

In this post I will share the right way of generating a Splash Screen. By using this way the user will not have to wait longer, there will not be a white Screen Flash when the App launches.

Splash Screen

So let’s begin :

Overview:

  • Create Activity: SplashScreenActivity
  • Create Background for splash screen splash_screen_background.xml
  • Create Style for Splash Screen
  • Set style for SplashScreenActivity in AndroidManifest.xml

Create SplashScreenActivity:

The SplashScreenActivity must be Launcher Activity.

package com.anuragdhunna.www.splashscreen;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

/**
*
@author anuragdhunna
*/
public class SplashScreenActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash_screen);

Intent intent = new Intent(getApplicationContext(),
MainActivity.class);
startActivity(intent);
finish();
}
}

Create Background for splash screen splash_screen_background.xml

In res/drawable directory create splash_screen_background.xml file with the following code.

Set a Background Image- It can be any image for example your Product Logo.

Create Style for Splash Screen

In res/values/styles.xml

Define SplashScreenTheme

Set style for SplashScreenActivity in AndroidManifest.xml

Set theme for SplashScreenActivity

Now, the Splash Screen is ready. Launch your app.

For information you can also check:

If you like my article, please don’t forget to hit 👏👏👏 and please recommend it to others 😊

Recommended Reading

Also, to be notified about my new articles and stories, follow me on Medium and Twitter. You can find me on LinkedIn as well. Cheers!

--

--

Anurag Dhunna
Viithiisys

Android, Java Software Developer. I write about technologies that I used in the journey of programming. Email: anurag.dhunna@gmail.com