In my app i showing google map version2 in a fragment. but i get Null pointer exception at
mMap = ((SupportMapFragment) getFragmentManager().findFragmentById(R.id
After hours of search, I did in this way:
public class MapFragment extends Fragment {
private GoogleMap map;
SupportMapFragment mapFrag;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// TODO Auto-generated method stub
setHasOptionsMenu(true);
View rootView = inflater.inflate(R.layout.fragment_map, container,
false);
fm = getActivity().getSupportFragmentManager();
map = ((SupportMapFragment) fm.findFragmentById(R.id.map)).getMap();
return rootView;
}
}