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.

Posted in Dev

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s