【发布时间】:2014-07-15 13:28:38
【问题描述】:
我正在使用谷歌地图进行项目。当前位置显示在新设备中,但未显示在旧 2.3 设备中。如何使当前位置在旧设备中可见。
我的代码:
public void initialiseMap()
{
if (googleMap == null) {
googleMap = ( (SupportMapFragment) getSupportFragmentManager().findFragmentById(
R.id.map)).getMap();
}
// check if map is created successfully or not
if (googleMap == null) {
Toast.makeText(getApplicationContext(),
"Sorry! unable to create maps", Toast.LENGTH_SHORT)
.show();
}
else
{
googleMap.setMyLocationEnabled(true);
googleMap.getUiSettings().setMyLocationButtonEnabled(true);
googleMap.getUiSettings().setCompassEnabled(true);
// UiSettings uiSettings = googleMap.getUiSettings();
// uiSettings.setMyLocationButtonEnabled(true);
}
//locationManager.requestLocationUpdates(provider, 20000, 0, this);
LatLng latLng = new LatLng(current_latitude, current_longitude);
googleMap.moveCamera(CameraUpdateFactory.newLatLng(latLng));
// Zoom in the Google Map
//googleMap.animateCamera(CameraUpdateFactory.zoomTo(15));
googleMap.animateCamera(CameraUpdateFactory.newLatLngZoom(latLng, 11.5f));
}
我听说使用支持库会有所帮助..有人也可以澄清这一点吗?
【问题讨论】:
-
我已经添加了支持库。
标签: java android google-maps