Learning Android Development

Splash Screen API with Jetpack Compose

Making your Android app first impression better

Maria Luíza
Mobile App Development Publication

--

Hello, amazing person on the internet! Hope you’re doing well.

The first impressions are crucial. Creating a captivating user experience from the moment an app is launched has become a top priority. Users expect seamless, engaging interactions right from the start, and this is where the Splash Screen API, combined with the cutting-edge Jetpack Compose, takes center stage.

Implementation

First things first, we need to implement the splash screen API in our dependencies, within the gradle(Module:app):

Theme

Now, let’s create the style for our splash screen. To do that, go to your values and create the splash resource:

You can name the style’s name as you prefer, but the parent’s name must be “Theme.SplashScreen”.

I am going to call some items to customize our screen:

windowSplashScreenBackground = background screen.

windowSplashScreenAnimatedIcon = the splash screen icon.

postSplashScreenTheme = the theme aftesplash screen.

Within your manifest, navigate to the activity tag and invoke the custom theme:

Calling

Head to our Main Activity to display our splash screen. Simply call the installSplashScreen() function:

That’s it! You now have a splash screen.

Blank Screen

If you encounter an issue with a blank screen while using this API, don’t worry. After calling the splash screen and proceeding to the next screen, you might experience a blank screen. To resolve this, simply call the setKeepOnScreenCondition{} function:

Conclusion

Gone are the days of static and mundane splash screens that merely act as loading indicators. With Jetpack Compose, a revolutionary toolkit for building native Android UIs, and the introduction of the Splash Screen API, developers now have the tools to transform their app’s launch sequence into an immersive and visually appealing experience.

All the code and examples it is in this repository.

Happy coding ❤

--

--

Maria Luíza
Mobile App Development Publication

I'm an Android developer (She/Her). Feel free to ask me anything about the Android world, learning Kotlin/Java & a bit of Dart.