How to Create Welcome Screen in Android Studio

Creating the Project

First you need to download and install the Android Studio (You can use “How to install android studio on windows for android developers? ” article in my blog). Also In that article has how to create the project. Refer that article first. So then let’s see how to create welcome screen in android studio.

You can watch this in youtube

Let’s learn How to Create Welcome Screen in Android Studio

First, right click on your Java main package. Then go to “new” and select “Activity”. After that go to “Empty Activity”. (If you don’t know how to get new activity click here to refer ) I’ll called it as “SplashActivity”.

Creating a new Activity

let’s design Layout Activity | xml Design part

In here I am going to add a simple image as a welcome screen. To do that I am going to add this image to the background in the layout. (If you want to refer what are the layouts we have in the Android Studio you can click here)

Adding background image to the layout.

Let’s do the Coding part

Go to Java class. In my project its called “SplashActivity.java”. Then you can copy this code into the onCreate method.

 final Intent i = new Intent(this,LoginActivity.class);
        Thread timer = new Thread(){
            public void run(){
                try{
                    sleep(2000);
                }catch (InterruptedException e){
                    e.printStackTrace();
                }finally {
                    startActivity(i);
                    finish();
                }
            }
        };
        timer.start();
Java class coding part

In here I need to go to the login activity (Intent i = new Intent(this,LoginActivity.class);), when the splash screen display after 2 seconds. (sleep(2000) use to holding the splash screen for 2 seconds). You can customize this.

Change your Manifest file

Almost finish. Now you have to change your Manifest file. To do that open your manifest file. (Also you can refer what is Manifest File )

You can see the below code in the MainActivity tab.

 <intent-filter>
       <action android:name="android.intent.action.MAIN" />
       <category android:name="android.intent.category.LAUNCHER" />
 </intent-filter>
Cut this code

This is the code to decide the firstly open screen when you open the App. So now you can understand we need to add this code to the “SplashActivity” tab. So let’s make it.

 <activity android:name=".SplashActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
</activity>
Add that code to splash activity

All done. now you can run your application.