Android Splash Screen Making

Android Splash Screen Making

Subscribe to my newsletter and never miss my upcoming articles

Splash screen is something we see in start of the app, We usually show the name and logo of our app on splash screen. We show it in the start of the app when we are waiting for the app to get fully loaded. Steps to make a Splash Screen:

  1. Create new Activity and name it "Splash_Activity".
  2. Design the activity front end as per your requirments
  3. Under the back end program file of the "Splash_Activity" write the code given below

This is the code to show the Splash Screen.

getSupportActionBar().hide();
          Thread background = new Thread() {
            public void run() {
                try {
                    Thread will sleep for 5 seconds
                    sleep(5*1000);

                    After 5 seconds redirect to another intent
                    Intent i=new Intent(getBaseContext(),MainActivity.class);
                    startActivity(i);

                    Remove activity
                    finish();
                } catch (Exception e) {
                }
            }
        };
        background.start();
  1. The next step is to make this Activity as the Launching Activity, for this purpose we have to modify the androidminifest file (AndroidManifest.xml file is located under the menfests folder which is the first folder under the project.)

  2. open the AndroidManfest.xml file and add the following intent-filter under the activity you just made.

<activity android:name=".Splash_Activity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
 </activity>

The purpose of this intent-filter in any activity is to make the activity lunching activity.

 
Share this