Sometime user open the SplashActivity
and quit immediately but the app still go to MainActivity
after SPLASH_SCREEN_DISPLAY_LENGTH
.
For prevent it: In SplashActivity
you should check the SplashActivity
is finishing or not before move to MainActivity
public class SplashActivity extends Activity {
private final int SPLASH_SCREEN_DISPLAY_LENGTH = 2000;
@Override
public void onCreate(Bundle icicle) {
...
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
if (!isFinishing()) {//isFinishing(): If the activity is finishing, returns true; else returns false.
startActivity(new Intent(SplashActivity.this, MainActivity.class));
finish();
}
}, SPLASH_SCREEN_DISPLAY_LENGTH);
}
}
}
Hope this help