How can I use the Android back button to move back within my app instead of closing my app?

前端 未结 4 748
迷失自我
迷失自我 2021-01-22 18:31

My app has three activities, A, B and C. I am moving from A to B through an OK button, and I want to move back from B to A by using the default back button of Android devices. W

4条回答
  •  天命终不由人
    2021-01-22 19:12

    When you are Ok button r u starting an intent...like

    Intent int=new intent(context,B.class); startActivity(int);

    then if you are not handling backbutton.

    If use default back button...it will goes back to A.

    Hope it helps...

提交回复
热议问题