How to correctly save instance state of Fragments in back stack?

后端 未结 6 1346
小鲜肉
小鲜肉 2020-11-21 11:57

I have found many instances of a similar question on SO but no answer unfortunately meets my requirements.

I have different layouts for portrait and landscape and I

6条回答
  •  失恋的感觉
    2020-11-21 12:08

    final FragmentTransaction ft = getFragmentManager().beginTransaction();
    ft.hide(currentFragment);
    ft.add(R.id.content_frame, newFragment.newInstance(context), "Profile");
    ft.addToBackStack(null);
    ft.commit();
    

提交回复
热议问题