Malo
Malo

Reputation: 1576

android google maps animate the camera slowly to my location

I need to move the camera to my location slowly in android, i use the code below but the camera change from position to another like switching between pages. this is my code

                 CameraPosition cameraPosition = new CameraPosition.Builder()
                            .target(location1)
                            .zoom(16)
                            .bearing(90)
                            .tilt(30)
                            .build();
                    googleMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition), 10000, null);

                    CameraUpdate center=
                            CameraUpdateFactory.newLatLng(location1);
                 //   CameraUpdate zoomcam=CameraUpdateFactory.zoomTo(zoom);

                    googleMap.moveCamera(center);

Upvotes: 9

Views: 5059

Answers (1)

Shubham Jain
Shubham Jain

Reputation: 7

Just remove googleMap.moveCamera(center);. Use only googleMap.animateCamera(center);.

Upvotes: 1

Related Questions