Finishing current activity from a fragment

前端 未结 11 1538
野的像风
野的像风 2020-12-13 02:02

I have a fragment in an activity that I am using as a navigation drawer. It contains buttons that when clicked start new activities (startActivity from a fragment simply ca

11条回答
  •  难免孤独
    2020-12-13 02:18

    In Fragment use getActivity.finishAffinity()

    getActivity().finishAffinity();
    

    It will remove all the fragment which pushed by the current activity from the Stack with the Activity too...

提交回复
热议问题