Change this
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
startActivity(new Intent(SplashScreen.this, MainActivity.class));
}
}, SPLASH_TIME_OUT);
SplashScreen.this.finish();
to
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
startActivity(new Intent(SplashScreen.this, MainActivity.class));
SplashScreen.this.finish();
}
}, SPLASH_TIME_OUT);
Also no need to finish Activity in onBackPressed
@Override
public void onBackPressed() {
SplashScreen.this.finish(); // Remove this
super.onBackPressed();
}