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
I was facing problem while adding GoogleMapFragment inside DialogFragment and I have solved it as
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
if (Build.VERSION.SDK_INT < 21) {
supportMapFragment = (SupportMapFragment) getActivity()
.getSupportFragmentManager().findFragmentById(R.id.mapDialog);
} else {
supportMapFragment = (SupportMapFragment) getActivity().getSupportFragmentManager()
.findFragmentById(R.id.mapDialog);
}
supportMapFragment.getMapAsync(this);
}
Override onDestroy() as
@Override
public void onDestroy() {
super.onDestroy();
if (null != supportMapFragment)
getActivity().getSupportFragmentManager().beginTransaction()
.remove(supportMapFragment)
.commit();
}