Skip to content Skip to sidebar Skip to footer

Android Google Map V2 MoveCamera Doesn't Work

I'm trying to control Google map camera like this private void setUpMap() { Log.e(LOG_TAG, 'in setup method'); mMap.setMyLocationEnabled(true); LatLng start

Solution 1:

try this: hope it will work.

private void setUpMap() {
    Log.e(LOG_TAG, "in setup method"); 
    mMap.setMyLocationEnabled(true);
    CameraPosition cameraPosition = new CameraPosition.Builder()
                .target(new LatLng(latitude, longitude)).zoom(15).build();
    mMap.animateCamera(CameraUpdateFactory
                .newCameraPosition(cameraPosition));
    Log.e(LOG_TAG, "in Setup method" + (mMapFragment == null));
}

Solution 2:

Your coordinates specified at LatLng startingPoint = new LatLng(129.13381, 129.10372); seems to be a bit off. In more detail, the maximum latitude is 90 degrees, which is the north pole (-90 is the south pole).

The result of this will be that the camera will not move to a position which is invalid.

Try using coordinates from a known location, such as LatLng startingPoint = new LatLng(55.70, 13.19); which will give you the position of Lund, Sweden.

So basically, revise the latitude and longitude coordinates for your position.


Post a Comment for "Android Google Map V2 MoveCamera Doesn't Work"