Removing empty screen when launching an app – Android


Removing empty screen or initial blank screen in Android

In Android, you may have noticed an empty screen that appears when launching an app. Sometimes this empty screen also appears when switching between two activities. Though this screen appears for less than a second only, still it is noticeable. In this article, I am going to show you how to remove this initial empty screen when launching an app or switching between activities.


If in your case it is happening when switching activities, the possible reason is your activity layout. If the layout activity is very complex or there’s a big size image, you could see a slight delay before opening the activity. This is where the blank screen appears.

Another reason for this empty screen is. when your destination activity is too complex. And you are calling finish() before starting the new activity.

Now when launching your app, at that time also an initial blank screen may appear. We can get rid of this by disabling the window preview. We can also disable the window preview when launching an activity in app.

Note –  Doing so, your app’s launching time may slow down a little bit. You may notice a slight delay when launching your app.

Let’s disable the window preview. In your project navigate to your res  – values folder and open styles.xml file.

Now we need to add a theme attribute to our styles.xml file.

Here we will add the windowDisablePreview attribute. What this attribute does is disable the initial white screen or blank screen or whatever you call it.

The initial value of the windowDisablePreview is set to false. We have to set it to true to disable it.

In your styles.xml file make a style like this –

Now apply this theme to your main activity or launcher activity.

If you want to remove the blank screen that is appearing when starting another activity, you can apply this theme to your destination activity or second activity. Suppose there are two activities in our app and we want to go to second activity from our first activity. Then we have to apply the newly created theme to our second activity.

Go to your project’s AndroidManifest.xml file and apply the theme to your second activity like this –

Now run your app and see if the white screen or blank screen appears or not. You can also directly apply this to your main theme like this –

Working with SharedPreferences – Android

Change Google map theme – Android

Hope this will solve your problem. If you need any further assistant, let me know in the comment section. I would be happy to help you.


You May Also Like

Leave a Reply

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