Splash Screen – Kotlin Tutorial Series – 1

Hello everyone,

In this article, I am going to try to show you how to create a splash screen on android and I will try to explain why we are using splash screens in the applications.

What is splash screen?

Splash screen is a first screen we see on application launch process. It usually contains application logo and maybe simple description about company or application.

Why we are using Splash Screen?

When we open an application, the android operating system prepares lots of things for us to use the application. This process can be longer than our expectations. It depends on the application backend. If we do not use a splash screen on our application, during this creation process, the user will not see anything except white blank screen. We create splash screens for hide this white screen, and for application integrity.

What should not be done for Splash Screen?

Some developers are creating new activity for splash screen and holding users on this screen for a while. After this process, they are redirecting users to main activity. It is not the correct solution for this process.

Let’s look at the right process together.

In this sample, we are going to add one icon and one application name image to our splash screen. I created a new blank project for this article. You can find the GitHub link at the end of the article.

Splash Screen File
Screenshot 1: Splash Screen file.

In this file, I defined my logo and description area as I explained in the previous sentence. It is possible to look wrong on android studio but at the end of the article, when you run the application, It will be fit for your screen. 

Screenshot 2: Splash screen file detail.

After this step, we are going to define a new theme and we are going to use a splash screen file as a background image. When users run our application, this theme will be the main theme. After loading, the theme will change on the main activity.

For this process, firstly we are going to open our theme file which is in the res/values folder. I added a new style tag for my new starting theme. It will be full screen and It will not have an action bar. The codes are like below.

Splash Activity Theme
Screenshot 3: Splash Screen theme.

Now, I am going to use this as a main activity’s theme. For this, I am going to add the theme property to my main activity tag on the AndroidManifest.xml and use my Splash Theme on there. The screenshot is like follows.

Android Manifest File
Screenshot 4: Android Manifest File.

Now, we are nearly done. Just after loaded application, we have to change our theme. For this, ,n Main activity file, we are going to add the following line.


Main Activity
Screenshot 5: Main Activity File

After last modification, If we run the application, the loading process will be like the following gif. Waiting process depends on your application. This is an empty application and because of that, the application is running fast.

I am currently learning Kotlin and I am thinking

I am currently learning Kotlin and I am thinking of sharing more tutorials during my learning process. Hopefully, It will be helpful for everyone.

See you in the next tutorial.

GitHub: https://github.com/cinarrtolga/ART-Splash-Screen

Leave a Reply

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