Add Splash Screen in Android App

Splash.java class

package com.yourpackagename;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;

/**
* Created by user on 4/14/2018.
*/

public class Splash extends Activity {
boolean start = true;

public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

setContentView(R.layout.screen_splash);
screenSplash();

}

public void onResume() {
super.onResume();
}

void screenSplash() {

{

new Handler().postDelayed(new Runnable() {
@Override
public void run() {


startActivity(new Intent(Splash.this, MainActivity.class));
finish();
}


}, 500);

}


}
}

Add this in Mainifests file

<activity
android:name=".Splash"
android:label="@string/app_name1"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

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

All Done 🙂

Leave a Reply

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