Restarting Android app programmatically

前端 未结 9 2019
独厮守ぢ
独厮守ぢ 2021-02-03 12:14

This is a follow up question to this question:

Force application to restart on first activity

I am trying to restart my application from a fragment like that:

9条回答
  •  灰色年华
    2021-02-03 12:32

    Tray this

    getActivity().finish();
    getActivity().startActivity(new Intent(getContext(), Main.class));
    getActivity().finishAffinity();
    

    where finishAffinity() close all other Intents

提交回复
热议问题