Avoid splash screen activity when pressing Back button

后端 未结 4 1635
悲&欢浪女
悲&欢浪女 2020-12-24 07:55

In my application, I\'ve two activities. First is a splash screen, which simply shows the application name and few other info. Upon clicking on the splash screen activity, I

4条回答
  •  一整个雨季
    2020-12-24 08:44

    As I understand, you want the splash activity to not show after changing activity. You should note activities save On Stack and with starting new activity push on it and with finish you pop on top stack. I think that if you the call finish() method your problem fix as in your splash screen activity where you call StartActivity insert finish() after

    public void onClick(View v) {
        Intent intent = new Intent(Main.this, Splash.class);
        startActivity(intent);
        finish();
    }
    

    Hope to be useful :)

提交回复
热议问题