June 19, 2018

Splash Screen on Kotlin language

         On this blog I am going to explain how to show a splash screen using Handler. You can find more about Handler from Here.

Here I am using a delay of 4000 MS (4 Seconds)


Here I am using  postDelayed function for this,

fun postDelayed(r: Runnable!, delayMillis: Long): Boolean


Sample Code

override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    setContentView(R.layout.activity_splash)
   
    Handler().postDelayed({
                 //Here Comes the code to execute after the time delay
      }, 4000)
}




---------------
Thanks For Reading, Wish you a Happy Coding....