我在跟踪集成地图上的活动时遇到了Java编译器错误。同一错误在三个位置发生。
这是错误消息: 错误:找不到符号变量OnMapReadyCallback
这是第一个的代码
private void initilizeMap() {
if (googleMap == null) {
googleMap = ((MapFragment) getFragmentManager().findFragmentById(
R.id.map)).getMapAsync(OnMapReadyCallback);
googleMap.setMyLocationEnabled(true);
// check if map is created successfully or not
if (googleMap == null) {
Toast.makeText(getApplicationContext(),
"Sorry! unable to create maps", Toast.LENGTH_SHORT)
.show();
}
}
这是第二个:
}
private void initilizeMap() {
if (googleMap == null) {
googleMap = ((MapFragment) getFragmentManager().findFragmentById(
R.id.map)).getMapAsync(OnMapReadyCallback);
googleMap.setMyLocationEnabled(true);
LatLng latLng = new LatLng(gps.getLatitude(), gps.getLongitude());
//googleMap.setOnMarkerClickListener(this);
// check if map is created successfully or not
if (googleMap == null) {
Toast.makeText(getApplicationContext(),
"Sorry! unable to create maps", Toast.LENGTH_SHORT)
.show();
}
}
这是第三个:
private void initilizeMap() {
if (googleMap == null) {
googleMap = ((MapFragment) getFragmentManager().findFragmentById(
R.id.map)).getMapAsync(OnMapReadyCallback);
googleMap.setMyLocationEnabled(true);
LatLng latLng = new LatLng(gps.getLatitude(), gps.getLongitude());
CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLngZoom(latLng, 14);
googleMap.animateCamera(cameraUpdate);
//googleMap.setOnMarkerClickListener(this);
// check if map is created successfully or not
if (googleMap == null) {
Toast.makeText(getApplicationContext(),
"Sorry! unable to create maps", Toast.LENGTH_SHORT)
.show();
}
}
}
我正在运行以下内容: Android SDK Build-Toos 29-rc2
以及 Android Q预览 Android 9.0(Pie),并已安装了Andriod 8.1至4.0.3(IceCreamSandwich)的所有内容
任何帮助将不胜感激! E