I'm new to android programming and have been struggling with this problem for a while. I read that getMap() has been deprecated and replaced by getMapAsync() However, I cannot seem to find a way of using getMayAsync() because it uses the a fragment resource and i did not require a fragment resource for the map till now.
Here is my code:
public class RunMapFragment extends SupportMapFragment {
private static final String ARG_RUN_ID = "RUN_ID";
private GoogleMap mGoogleMap;
public static RunMapFragment newInstance(long runId) {
Bundle args = new Bundle();
args.putLong(ARG_RUN_ID, runId);
RunMapFragment rf = new RunMapFragment();
rf.setArguments(args);
return rf;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup parent,
Bundle savedInstanceState) {
View v = super.onCreateView(inflater, parent, savedInstanceState);
mGoogleMap = getMap(); //Error here
mGoogleMap.setMyLocationEnabled(true);
return v;
}
}
Any help would be much appreciated. Is it possible to rollback the map API minimum sdk to verison 9 where getMap() can be used?