I have searched on stackoverflow and looked at so many solutions for example, here
I have looked at more but none of them robust in terms of performance. Here is what I got so far
This one works but only once when the fragment first created but then after returning to the map fragment it gives me layout inflation exception
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState)
{
view=inflater.inflate(R.layout.fragment_public_maps,null,false);
googleMap= (SupportMapFragment) getChildFragmentManager().findFragmentById(R.id.pub_map);
googleMap.getMapAsync(this);
return view;
}
I have tried this one also and it works but it makes my app slow and sometimes it crashes
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState)
{
try
{
view=inflater.inflate(R.layout.fragment_public_maps,null,false);
}
catch (InflateException e)
{
googleMap= (SupportMapFragment) getChildFragmentManager().findFragmentById(R.id.pub_map);
googleMap.getMapAsync(this);
return view;
}
googleMap= (SupportMapFragment) getChildFragmentManager().findFragmentById(R.id.pub_map);
googleMap.getMapAsync(this);
return view;
}
I don't know what else to do if anyone can point me to the right direction I would really appreciate it.