Set up Splash screen in Android Studio

splash screen is a graphical control element consisting of window containing an image, a logo and the current version of the software. A splash screen usually appears while a game or program is launching.

Image result for Splash screen

import android.os.Bundle;

import android.os.Handler;
import android.content.Intent;
import android.view.Menu;
public class MainSplashScreen extends Activity {
    protected void onCreate(Bundle savedInstanceState) {
// METHOD 1    
        /****** Create Thread that will sleep for 5 seconds *************/
        Thread background = new Thread() {
            public void run() {
               try {
                    // Thread will sleep for 5 seconds
                    // After 5 seconds redirect to another intent
                    Intent i=new Intent(getBaseContext(),FirstScreen.class);
                    //Remove activity
                } catch (Exception e) {              
        // start thread
        new Handler().postDelayed(new Runnable() {
            // Using handler with postDelayed called runnable run method
            public void run() {
                Intent i = new Intent(MainSplashScreen.this, FirstScreen.class);
                // close this activity
        }, 5*1000); // wait for 5 seconds
    protected void onDestroy() {

Leave a Comment

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