Fragment isAdded() returns false on an already added Fragment

前端 未结 2 948
离开以前
离开以前 2020-12-15 06:57

I have this neat function:

private void addMapFragment(){
    if(!mapFragment.isAdded()){
        FragmentTransaction ft = getFragmentManager().beginTransact         


        
2条回答
  •  执念已碎
    2020-12-15 07:28

    Instead, check getSupportFragmentManager.findFragmentById() and see if you are getting the expected fragment back. If now you can add and commit.

提交回复
热议问题