Placing SupportMapFragment on DialogFragment

后端 未结 3 1928
野趣味
野趣味 2021-01-06 17:00

I\'m trying to add SupportMapFragment on DialogFragment, but it return error inflating class fragment. I cannot figure it out why its returned error infla

3条回答
  •  梦毁少年i
    2021-01-06 17:47

    Try this..

    Change this..

    mapDetail = ((SupportMapFragment) getFragmentManager().findFragmentById(R.id.map_data))
                    .getMap();
    

    to

    mapDetail = ((SupportMapFragment) getActivity().getSupportFragmentManager().findFragmentById(R.id.map_data))
                    .getMap();
    

提交回复
热议问题