0
我是新來的android編程,一直在努力解決這個問題。我讀了getMap()已被棄用,取而代之的是getMapAsync() 但是,我似乎無法找到使用getMayAsync()的方式,因爲它使用片段資源,直到現在我並不需要片段資源。無法解析getMap()或替換爲getMapAsync()
這裏是我的代碼:
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;
}
}
任何幫助將非常感激。 是否可以將地圖API最小sdk回滾到可以使用getMap()的版本9?
非常感謝你! –