Animated Splash Screen in Android Studio

Following are the steps to create animated splash screen in android studio :

(1) Step – 1 : Create a anim directory and than add a new animation resource file in it and name it splashscreentransition.xml

<?xml version=”1.0″ encoding=”utf-8″?>

<alpha

xmlns:android=”http://schemas.android.com/apk/res/android&#8221;
android:fromAlpha=”0.0″
android:toAlpha=”1.0″
android:duration=”2000″ />

(2) Step – 2 Create a Empty activity and name it as SplashScreenActivity and edit splashscreenactivity.xml

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".SplashScreenActivity"
    android:orientation="vertical"
    >

 <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        android:gravity="center">

        <ImageView
            android:layout_width="100dp"
            android:layout_height="100dp"
            android:src="@mipmap/ic_launcher"
            android:layout_gravity="center"
            android:id="@+id/splashimg"/>
    </LinearLayout>

</LinearLayout>

(3) Step – 3 : Now write the backend code for SplashScreenActivity.java

public class SplashScreenActivity extends AppCompatActivity {
ImageView splashimg;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_splash_screen);

    splashimg = (ImageView)findViewById(R.id.splashimg);

    Animation splashAnim = AnimationUtils.loadAnimation(this,R.anim.splashscreentransion);
    splashimg.startAnimation(splashAnim);

    final Intent intent = new Intent(this,MainActivity.class);

    Thread timer = new Thread(){
        public void run(){
            try{
                sleep(5000);
            }catch (InterruptedException e){
                e.printStackTrace();
            }finally{
                startActivity(intent);
                finish();
            }
        }
    };
    timer.start();
}
}

(4) Now run and check the app to watch full tutorial watch the video.