January 31, 2022

Splash Screen in Kotlin

          On this blog I am going to explain how to show a splash screen using Handler. You can find more about Handler from Here.  On this I am going to show the redirection to new Activity page after the delay I set.  Redirection will be from SplashActivity which is my splash screen to MainActivity which is my landing page

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

import android.content.Intent
import android.os.Bundle
import android.os.Handler
import androidx.appcompat.app.AppCompatActivity
import com.example.MainActivity
class SplashActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {


val intent = Intent(this, MainActivity::class.java)
        }, 4000)


Setup new Kotlin project on Android Studio


On this blog I am going to explain How to setup new Kotlin project on Android Studio. To setup new project on Kotlin on Android project we need Android Studio version 3.0 or more. For older version of studio we can user Pligins. You can able to download by selecting "Install JetBrains plugin". 

Here is the steps to start new Android Project with Kotlin Support.

Goto File => New => NewProject

While select New Project you can see the Create New Project window

 You can add the project details such as Application NameCompany domainProject LocationPackage name etc. And By selecting "Include Kotlin Support" you can enable the Kotlin support on your Project.

After This Screen while tap on "Next" button it will show the screen to Select the Target Device,

This screen will allow you to choose the Android  Target Device you need, While tap on Next button it will show the Choose Activity Screen

On this screen you can select the Type of Activity we need on the Application. While Tap on Next button it will show the screen to Configure the selected Activity page.

On this Screen we can Add the Activity Name and the layout name. And while Tap on Finish button it will Create the New Project with your Configurations. While tap on finish button it will setup your first project. Here is the project window.