Splash Screen in Android Studio in 5 Minutes
Add a splash screen that shows your logo for a moment before the app opens. Quick to build and a nice first polish for any app.
What you'll learn
- Design a splash layout with your logo
- Open the main screen after a short delay
- Make the splash the app's launch screen
Before you start
- Android Studio (any recent version)
- An emulator or an Android phone
How it fits together
- 1App opens
- 2SplashActivity shows logo
- 32-second delay
- 4MainActivity
Build it step by step
1. Create the project
In Android Studio choose New Project → Empty Views Activity, with Language Java and Minimum SDK API 24.
2. Add a splash activity
Right-click your package and choose New → Activity → Empty Views Activity. Name it SplashActivity.
3. Design the splash screen
In activity_splash.xml, centre your logo (an ImageView), the app name and a short tagline. Put your logo in res/drawable; a vector drawable stays sharp on every screen.
4. Make the background appear instantly
Create a splash theme whose android:windowBackground is your brand colour, and give SplashActivity that theme in the manifest. The colour then shows the moment the app opens, before the layout has loaded.
5. Make the splash open first
In AndroidManifest.xml, move the MAIN / LAUNCHER intent filter from MainActivity to SplashActivity.
6. Wait, then open the app
In SplashActivity, use a Handler to run code after 2 seconds: start MainActivity, then call finish() so Back doesn't return to the splash.
7. Don't open the app after the user has left
If the user leaves during those 2 seconds, cancel the delayed code in onDestroy with removeCallbacks. Otherwise MainActivity pops up later on its own.
8. Run it
The purple splash shows with your logo, then the home screen opens.
Good to know
- Android 12 and later always show a short system splash (your app icon) first. With this approach users see that, then yours. For a single, modern splash, follow the Animated Splash Screen tutorial, which uses the SplashScreen API.
- Keep the delay short. Two seconds is plenty; a splash should never hold up a user who wants to get going.
What's improved over the video
The background shows instantly through the theme, the delay is cancelled if the user leaves, and the splash finishes so Back doesn't return to it.
Files affected
Check what to add and what to replace before copying code.
- app/src/main/java/com/example/splashscreen/MainActivity.javaReplace file
- app/src/main/res/layout/activity_main.xmlReplace file
- app/src/main/res/layout/activity_splash.xmlAdd these lines
- app/src/main/AndroidManifest.xmlReplace file
- app/src/main/res/values/colors.xmlReplace file
- app/src/main/res/drawable/ic_logo.xmlAdd these lines
- app/src/main/java/com/example/splashscreen/SplashActivity.javaAdd these lines
- app/src/main/res/values/strings.xmlReplace file
- app/src/main/res/values/themes.xmlReplace file
Application code
Select a file to see its code and where it belongs.
This code uses package com.example.splashscreen. Change that first line to your own package, the one at the top of your MainActivity.
app/src/main/java/com/example/splashscreen/MainActivity.javaYour app's real first screen.
package com.example.splashscreen;
import android.os.Bundle;
import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;
/** The app's real first screen, opened by SplashActivity. */
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EdgeToEdge.enable(this);
setContentView(R.layout.activity_main);
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
Insets bars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
v.setPadding(bars.left, bars.top, bars.right, bars.bottom);
return insets;
});
}
}


