Exit/Finish an app/activity - android

前端 未结 12 745
醉梦人生
醉梦人生 2021-02-05 05:04

I\'ve got 4 activities say Act1, Act2, Act3 and Act4. A button in Act1 opens Act2, a button in Act2 opens Act3, a button in A

12条回答
  •  囚心锁ツ
    2021-02-05 06:02

    finish previous activity when you are go to the next activity means write finish(); after startactivity(intent); and write below code for start first activity from fourth activity's button click event.

    Intent in1=new Intent(Act4.this, Act1.class);
    startActivity(in1);
    finish();
    

    And Write Below Code on Your Exit Button's Click event in all activities.

    finish();
    

提交回复
热议问题