As per google developer's guide here,to animate camera on specific position

CameraPosition cameraPosition = new CameraPosition.Builder()
    .target(MOUNTAIN_VIEW)      // Sets the center of the map to Mountain View
    .zoom(17)                   // Sets the zoom
    .bearing(90)                // Sets the orientation of the camera to east
    .tilt(30)                   // Sets the tilt of the camera to 30 degrees
    .build();                   // Creates a CameraPosition from the builder
map.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));

But, in api reference, CameraPosition has already a constructor defined as:

public CameraPosition (LatLng target, float zoom, float tilt, float bearing)

So, If I write as:

  CameraPosition cameraPosition = new CameraPosition(latLng,9,0,0);

or

 CameraPosition cameraPosition = new CameraPosition.Builder().target(latLng).zoom(9).build();

are they both same or different? Is there any need of using static nested class CameraPosition.Builder as per reference?

Also, both have same description:

CameraPosition constructor:

Constructs a CameraPosition.

public CameraPosition build():

Builds a CameraPosition.

I doubt if there is any difference between words constructs and builds. Unfortunately, there isn't any information on whole internet about their difference (if exists). Can anyone help please?

Related posts

Recent Viewed