在Android上使用google map v2,我设置了setMyLocationEnabled(true)
但是没有任何动作或任何东西,它找不到。
这是我的代码的一部分,我该如何解决它:
public class Location extends Activity {
private GoogleMap mMap;
GoogleApiClient mGoogleApiClient;
Marker mMarker;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.location);
mMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
mMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
// mMap.moveCamera( CameraUpdateFactory.newLatLngZoom(new LatLng(36.755113, 3.058781) ,6) );
CameraUpdate center =
CameraUpdateFactory.newLatLng(new LatLng(36.755113,
3.058781));
CameraUpdate zoom = CameraUpdateFactory.zoomTo((float) 5.4);
mMap.moveCamera(center);
mMap.animateCamera(zoom);
mMap.setMyLocationEnabled(true);
));
}
public GoogleMap getMap() {
return mMap;
}
@Override
public void onStop() {
super.onStop();
if (mGoogleApiClient != null && mGoogleApiClient.isConnected()) {
mGoogleApiClient.disconnect();
}
}
}