In this implementation it shows how to display the splash screen for a fixed duration at the start of your Android App.
Steps involves:
1. Including the Splash image as Asset in your Android project.
2. Creating he Splash screen layout resource (XML file).
3. Creating the Splash Screen Java class.
4. Updating the Manifest file to call the Splash screen Java class as the main launcher. Declare MainActivity class also in the Manifest file.
I hope you like this video. For any questions, suggestions or appreciation please contact us at: https://programmerworld.co/contact/ or email at: [email protected]
Complete source code and other details/ steps of this video are posted in the below link:
https://programmerworld.co/android/ho...
However, the main Java code is copied below also for reference:
package com.programmerworld.splashscreenandroidapp;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
public class SplashScreen extends AppCompatActivity {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splash_screen);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
startActivity(new Intent(SplashScreen.this, MainActivity.class));
finish();
}
}, 1000);
}
}
--