splash screen android kotlin

Splash Screen Android Kotlin | Working Example Android

In this Tutorial I will explain how you can build a Splash Screen for your Android Application. Let us learn how to develop a splash screen in android using Kotlin language.

Before we start let’s first understand what is a Splash Screen.

What is a Splash Screen:

A Splash screen is a quick screen that appears for one or more seconds before the main screen of the application displays. It can have Image, Text, Logo or any similar details according to the application. It is a very common feature in android applications and is found almost in all android applications. Some applications display progress bar in their splash screens before moving to the Main Activity.

Splash Screen In Android Kotlin:

1- Start a new Android Studio Project and name it as “SplashScreen” or you can name it whatever you want. Select API level 19 and default language should be Kotlin.

2- Go to build.gradle (Module: app) and add this dependency.

 

3- Now, right click on your package name and select New —> Activity —> Empty Activity. Name this activity as ” SplashScreen ” or name it whatever you want.

4- Go to activity_splash_screen.xml and change the default Constraint Layout to Relative Layout.

5- I will simply add an Image to my Splash Screen. You can add Image, Text, Logo anything as par your need.

6- Add an Image View to your Relative Layout with match_parent width and height.

7- After giving an id, width and height the final image view will be like this.

 

8- Now go to SplashScreen.kt file and in onCreate method add the following code.

 

9- Above onCreate method we add a value to define for how much time we are going to display our Splash Activity.

 

10- Now, in our own create method use Handler().postDelayed() method and inside this method we will call an intent to start our splash activity.

 

11- Go to your activity_main.xml file and change the default Constraint Layout to Relative Layout. Add a TextView in your Relative Layout like this.

 

12- Go to your AndroidManifest.xml file. Find the intent-filter code and add it under your Splash Screen activity like this.

 

13- Here we are done with our code. Run the application to see the output. Enjoy 🙂

OUTPUT

Splash Screen Android Kotlin | Working Example Android
splash screen android kotlin
Splash Screen Android Kotlin | Working Example Android
splash screen android kotlin

 

 

More Android Posts:

How To Check Internet Connection in Android Programmatically

AlertDialog Android Kotlin | AlertDialog in Kotlin with Example

RecyclerView With Data Binding in Android Kotlin: Example With Kotlin

How To Display Text in TextView Using Kotlin: Android Studio Kotlin Example

1 thought on “Splash Screen Android Kotlin | Working Example Android”

  1. Pingback: Check Internet Connection Programmatically Android Kotlin - My Android

Leave a Comment

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