when I am trying to show the maps on my fragment it is returning null pointer exception. I have added everything to the manifest each and every permission. I am attaching the f
You have to wait until map getting loaded....
public class ChatFragment extends Fragment implements OnMapReadyCallback {
private void initilizeMap() {
//SupportMapFragment mapFragment = (SupportMapFragment) fragmentManager.findFragmentById(R.id.map);
SupportMapFragment mapFrag = (SupportMapFragment) getChildFragmentManager().findFragmentById(R.id.map);
mapFrag.getMapAsync(this);
}
@Override
public void onMapReady(final GoogleMap map) {
googleMap = map;
//Do other stuff..........
}
}
Edit
SupportMapFragment mapFrag = (SupportMapFragment) getChildFragmentManager().findFragmentById(R.id.map);
Check the edit code, use ChildFragmentManager.