Setar Bearing using Cameraupdate

Asked

Viewed 35 times

1

I have two positions (LatLong) I’d like to center them on the map!

For that, I’ll tell you what:

 final LatLngBounds.Builder builderZoom = new LatLngBounds.Builder();
        if(null != mCurrentLocation){
            builderZoom.include(new LatLng(mCurrentLocation.getLatitude(), mCurrentLocation.getLongitude()));
        }
        if(null != mLocation){
            builderZoom.include(new LatLng(mLocation.getLatitude(), mLocation.getLongitude()));
        }
        final CameraUpdate cu = CameraUpdateFactory.newLatLngBounds(builderZoom.build(), 55);
        mMap.moveCamera(cu);

So far so good!

Now I need to update the bearing from the map, and I do it this way:

   CameraPosition cameraPosition = new CameraPosition.Builder().
                                target(new LatLng(mCurrentLocation.getLatitude(), mCurrentLocation.getLongitude())).
                                zoom(mMap.getCameraPosition().zoom).
                                bearing(mCurrentBearing).
                                build();
                        mMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));

In this case, I pass the target cancelling the first part!

I would like to know if: I can pass a LatLngBounds in a CameraPosition instead of target?

Or whether in a CameraUpdate I can modify the bearing?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.