Android : Quick and Simple Splash Screen

Photo by Shuvro Mojumder on Unsplash

Splash screens provide a simple initial experience (typically of the application logo) while your mobile app loads. They set the stage for your application, while allowing time for the app to initialise.

Implementing Splash Screen is pretty straightforward. I will directly proceed to the code.

Create an empty activity, and design it’s xml as per your requirements.
In my case I have a simple xml file with a TextView.

Then in your activity, we will write the logic for launching the main activity which we intend to launch after displaying the Splash Screen.

I have defined constant time out value for the splash screen as 3000ms.

I have, also on purpose, hidden the action bar to give my Splash Screen a bigger and a better view.

Finally I have used the plain old handler to create a delay of 3 seconds, and then I launch the HomeActivity.

Splash screen should only be displayed when the app is launched for the first time or from the killed state and not if the user presses the back button — for that I finally call the finish() method after launching the intent.

You can find the project here : https://github.com/aroranubhav/SplashScreenDemo

Engineer | Photographer