Sitemap
AndroidPub

The (retired) Pub(lication) for Android & Tech, focused on Development

Follow publication

Splash Screen in Android: The Right Way

2 min readMar 6, 2017

My new blog pallocchi.dev is now available! 🥳

After a research, I’ve found a lot of tutorials about splash (or launch) screen implementations on Android, but developers usually add a Runnable with a fixed time as delay to solve it. That solution was not an option for me, because I don’t want to force my app users to wait when there is nothing to load actually. Let me show you a great solution with minimal modifications that shows the splash screen while the app is loading.

This is what I’ve done in that way

Let’s code

First, we have to design the splash screen layout as a drawable. I’ve used my app logo as the center bitmap, and the primary color as background.

Now, we need to define a theme with the windowBackground value as the previous drawable.

Then, the theme must be assigned to the Main activity.

Finally, we have to replace the splash theme with the original of the Main activity.

Conclusion

With this approach, the splash screen is showed during the app initialization when it’s useful. Also, there is no need to create an extra activity to launch the splash, preventing delays associated with the activity creation. Keep the splash drawable as simple as possible, and you’ll love how fast it works.

That’s all folks!

Medium Logo
Medium Logo

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

AndroidPub
AndroidPub

Published in AndroidPub

The (retired) Pub(lication) for Android & Tech, focused on Development

Pablo Pallocchi
Pablo Pallocchi

Responses (16)

Write a response