Fragment's onResume() not called when popped from backstack

前端 未结 7 2030
梦谈多话
梦谈多话 2021-02-04 01:17

Hi I am developing android application in which I am using I am using single Activity and 3 fragments. So consider I have 3 fragments A B C. When I switch from A to

7条回答
  •  我在风中等你
    2021-02-04 01:49

    Try to use the replace method instead add on the FragmentTransaction. This work for me:

    FragmentTransaction ft = activity.getSupportFragmentManager().beginTransaction();
    ft.replace(R.id.fragment_container, fragment);
    ft.addToBackStack(null);
    ft.commit();
    

提交回复
热议问题