Dauris Little
all
  • About
  • Dauris’s Portfolio
  • Blogging Lyf
  • Contact
© 2016 Dauris Little. All rights reserved.
  • Home
  • Blog
  • Programming Languages
  • Android
  • Oh, I need A Splash Screen, Right?
November 7, 2025

BLOG & Gossip

Avatar photo
Dauris
Sunday, 18 April 2021 / Published in Android, Kotlin, Programming Languages, Tutorial

Oh, I need A Splash Screen, Right?

If you have had any smart phone before the I am sure you have seen a splash screen before. If you have not then for your information a spalsh screen is a screen that displays when you first open an app on the device. Many developer may refers to this as a launch screen and displays when that app is loading after being opened. When this loading process has completed, it transitions to a different screen where actual actions can be performed.

If you have noticed these splash sceen you most definitely noticed that they tend to only display for a short time and then its gone. Personally I feel that the splash screen is pretty vital part to any application since it is the user’s first impression/experience with the application.

Implementing Splash Screens

There are technically two ways to implement a splash screen.

Using a Timer (Get It Together)

This is the old easy approach. You have to create a dedicated splash screen Activity that shows up for  x seconds then opens the appropriate activity. You get more flexibility here as you can add animations, custom views or any other element you can normally fit into an Activity layout. A very basic implementation of this  is below

class SplashActivity : AppCompatActivity() {

    //setting the timer for the activity
    private val SPLASH_TIMER:Long = 5000 // this equates to seconds

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_splash)

        //fire after timer expires
        timedSplashScreen()
    }


    private fun timedSplashScreen() {
        Handler().postDelayed({
            //start the main activity
            startActivity(Intent(this, MainActivity::class.java))
        }, SPLASH_TIMER)
    }
}

Advantages:

  • You can display awesome animation or some custom design that has been built. For example,  the development of games.
  • perform alternative activities on the splash screen

Disadvantages

  • the launcher activity  doesn’t show up immediately
    • this is even worst during a cold start
  •  additionally, during cold start the user is stuck looking at the windowBackground
    • afterward, the user still waits until the splash screen time expires before the app content
  • Don’t expect the animation to wow your user every time

Using a Smart Timer (Get It Together)

This is very similar to the timer method listed above. The difference here is rather than make the delay be fixed, you vary it based on whether this is the user’s first time launching the app or not. We can accomplish this by using the SharedPreferences.

class SmartSplashActvity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_smart_splash_actvity)

        splashScreenKey()
    }

    private fun splashScreenKey() {
        val sp = getPreferences(MODE_PRIVATE)
        val firstLaunchPrefKey = "pref_first_launch"

        val splashDuration = when (sp.getBoolean(firstLaunchPrefKey, true)) {
            true -> {
                //
                sp.edit().putBoolean(firstLaunchPrefKey, false).apply()
                5000
            }
            false -> {
                //
                10000
            }
        }

        splashScreenDuration(splashDuration)
    }

    private fun splashScreenDuration(splashDuration: Int) {
        Handler().postDelayed({
            startActivity(Intent(this, MainActivity::class.java))
        }, splashDuration.toLong())
    }

}

Advantages:

  • All the advantages that timer accomplished
  • this method could aid in getting to the content quicker to the user.

Disadvantages

  • all the disadvantages that exist for timer method

Splash Screen Best Practice

Now doing what needs to be done the right way. When the app is launched and has been in the memory yet, there is a delay between when the user started your app and when the launcher Activity’s onCreate() is called. During this what we call a “cold start”, the window manager tries to draw a UI placeholder using elements from the theme.xml. The key is creating a custom theme that overrides windowBackground, then replacing that custom theme with your standard theme before calling super.onCreate() in the activity.

class DedicatedSplashScreen : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        startActivity(Intent(this, MainActivity::class.java))
        finish()
    }

}
  • Keep it free from unnecessary distraction
  • Don’t use multiple colors or logos
  • Use animation sparingly

Splash screens are simple. They’re used to enhance a brand and give users something nice to look at as they wait. .

  • Tweet
Tagged under: android, android development, androidx, splash screen, splash screen w/ android

What you can read next

Show/Hide On-Screen Keyboard
Android reCAPTCHA
Integrating Google’s reCAPTCHA w/Android
Discovering C# with Console

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Categories

Recent Posts

  • Gesture Controls for Android w/Kotlin

    Incorporating Gesture controls in your android ...
  • Android Rating: In-App Review API

    An app rating and reviews are crucial if you wa...
  • QR Reader in Android w/ Kotlin

    Turn your phone's camera into a QR scanner...
  • Creating Advance Custom Snackbar w/ Kotlin

    Ask 100 different developers about what they fi...
  • Swift Has Tuple

    Swift provides us with a type called Tuple whic...

Recent Comments

  • Homepage on Integrating Google’s reCAPTCHA w/Android
  • Cleora Weideman on Integrating Google’s reCAPTCHA w/Android
  • alpha femme keto Reviews on Integrating Google’s reCAPTCHA w/Android
  • best skin care products reviews on Integrating Google’s reCAPTCHA w/Android
  • Robyn on Integrating Google’s reCAPTCHA w/Android

Archives

  • January 2022
  • December 2021
  • September 2021
  • June 2021
  • May 2021
  • April 2021
  • March 2021
  • February 2021
  • January 2021
  • December 2020
  • October 2020
  • August 2020
  • July 2020
  • May 2020
  • March 2020
  • February 2020
  • December 2019
  • October 2019
  • September 2019
  • May 2019
  • March 2019
  • February 2019
  • January 2019
  • August 2018
  • April 2018
  • August 2017
  • November 2016
  • August 2016

Categories

  • .NET & .NET Core
  • Active Directory
  • Android
  • API
  • bitcoin
  • blog
  • C#
  • Development
  • E-Commerce
  • HTML5
  • iOS
  • Java
  • Javascript
  • Kotlin
  • Language
  • Like I Am Five
  • Mobile Development
  • New Web Site
  • Programming Languages
  • Swift
  • Tutorial
  • Uncategorized
  • Web Application Development
  • Windows AD

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org

© 2015. All rights reserved. Buy Kallyas Theme.

TOP
This site uses tracking cookies to personalize content and ads. AcceptLearn More