FragmentTransaction is not allowed to be added to back stack?

前端 未结 4 1977
迷失自我
迷失自我 2021-01-22 21:18

why cant my fragments be added to back stack?

@Override
    public void onTabSelected(Tab tab, android.app.FragmentTransaction ft) {
        FragmentTransaction          


        
4条回答
  •  南笙
    南笙 (楼主)
    2021-01-22 22:15

    Get rid of your transaction and, instead, use the FragmentTransaction provided in the callback. There's no need to instantiate a new FragmentTransaction when one is already handed to you. Pass in whatever you want into your call to ft.addToBackstack(); and then call ft.commit();

提交回复
热议问题