Issue
I have an android application with google map. I want to rotate the map view after getting the route direction to forward view.. How can I do it? Picture 1- Backward view ![This is the backward direction view. I need to rotate it to forward][1]
http://i.stack.imgur.com/gKkGe.png
Solution
You can get bearing from the location, that you received from the LocationManager
and set it to the CameraPosition
, like this:
Location location = googleMap.getMyLocation();
if (location != null) {
CameraPosition position = CameraPosition.builder()
.bearing(location.getBearing())
.target(new LatLng(location.getLatitude(), location.getLongitude()))
.zoom(googleMap.getCameraPosition().zoom)
.tilt(googleMap.getCameraPosition().tilt)
.build();
googleMap.animateCamera(CameraUpdateFactory.newCameraPosition(position));
}
Then your camera will rotate to your direction;
Answered By - romtsn
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.