Set bearing using CameraUpdate

1

I have two positions ( LatLong ) that you would like to center them on the map!

For this, I do the following:

 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 of the map, and do the following:

   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 that aborts the first part!

I would like to know if: Can I pass LatLngBounds to CameraPosition instead of target ?

Or if in CameraUpdate can I modify the bearing ?

    
asked by anonymous 17.02.2017 / 17:02

0 answers