DEV Community

Cover image for Android: Splash Screen with Kotlin
Roberto Orozco
Roberto Orozco

Posted on • Edited on • Originally published at isscroberto.com

Android: Splash Screen with Kotlin

There are different opinions on whether having a splash screen on your Android application or not.

Personally, I think splash screens are a good place where you can showcase your app's nice design and give your users a good first impression.

So, this is how I've been implementing splash screens on my recent Android apps with Kotlin.

Static vs Animated

I've used both static and animated splash screens and here are some thoughts.

Static

  • Showed only in the launching of your app before onCreate() is called.
  • You're not wasting your users time.
  • Not intended to run operations while the splash screen is shown.

Animated

  • You can show a cool animation and custom design.
  • Flexibility to perform some operations while the animation finishes.
  • Users can get bored if the animation is useless or if it takes too long.

Static Android Splash Screen

one-breath-splash

1.

Create the drawable file that we will use as background in the entry activity, by using a background, the app will show it without having to inflate a layout file.

2.

Create a theme in the styles file with no action bar that uses the splash drawable as the background to set it in the entry activity.

3.

Set the new style as a theme for the splash activity in your app manifest.

4.

Add the code to navigate to the next activity as soon as the app has finished loading.

Animated Android Splash Screen

power-nap-splash

When I use animated splash screens I like to keep showing the static part of the splash screen on the initialization so I repeat steps 1, 2 and 3 from above and just add the animation functionality.

4.

For the animated splash screen, we will inflate a layout with the element or elements we want to animate. In this case, I'm just animating a textview.

5.

Now we need to modify the splash activity to enable the animation and perform some loading operations in the meantime. Here's how my splash activity looks like.

That's it, please share your thoughts on Android splash screens and your comments on how to improve this implementation.

Top comments (8)

Collapse
 
adeel_afc profile image
عديل | Adeel

Hi, Roberto. Thanks for this. I have a small question

We are using splash screens in our apps to load background data. Now, often depending upon how fast is the user's internet, those items can take an awful long time so it often feels like the app is stuck on splash. We've shown a progress dialog to avoid this confusion.

What do you think about a progress dialog on splash?

Collapse
 
robertoor profile image
Roberto Orozco

Hi Adeel, I think a progress dialog may be a good thing, especially if the loading it's taking to long.

My approach would be to show the animated splash screen while loading data, after the animation ends, if the connection is slow and the data has not finished loading yet, then show a progress indicator to let know the user the app is still loading.

Collapse
 
tarzan212 profile image
tarzan212

Is the data you are loading critical to the functioning of your app ?

Collapse
 
adeel_afc profile image
عديل | Adeel

Yes, very.

Thread Thread
 
tarzan212 profile image
tarzan212

I think that as long as your providing a visual feedback that something is going on, you are doing things right. However, in my personal point of view, I prefer the "facebook" loading design (goo.gl/images/h29Bve) rather than a progress bar. But then it all depend on your use case :)

Collapse
 
chrisvasqm profile image
Christian Vasquez

Thanks Roberto! I was just thinking how does animated splash screens work yesterday hahaha.

I'll make sure to bookmark and share your post with others too :)

Collapse
 
robertoor profile image
Roberto Orozco

I'm glad it helped Christian! :)

Collapse
 
hensin profile image
Petro Kabakov

Hi, thanks for the article. I have a question regarding the UX:
What if user is inpatient and minizes the app while loading is still in progress? Won't he be annoyed by the app appearing from the background after some time, when loading is finished?