In Fragment on back button pressed Activity is blank

前端 未结 11 1728
囚心锁ツ
囚心锁ツ 2020-11-29 20:04

I have an Activity and many fragments inflated in same FrameLayout



        
11条回答
  •  情话喂你
    2020-11-29 20:36

    Sorry for the late response.

    You don't have to add ft.addToBackStack(null); while adding first fragment.

    FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
    ft.replace(R.id.content_frame, profileFragment);
    // ft.addToBackStack(null); --remove this line.
    ft.commit();
    // ... rest of code
    

提交回复
热议问题