Answers for "Creategoogle maps marker with custom image/bitmap"

0

Creategoogle maps marker with custom image/bitmap

@Override
public void onMapReady(GoogleMap googleMap) {
    mMap = googleMap;


    //When Map Loads Successfully
    mMap.setOnMapLoadedCallback(new GoogleMap.OnMapLoadedCallback() {
        @Override
        public void onMapLoaded() {

            LatLng customMarkerLocationOne = new LatLng(28.583911, 77.319116);
            LatLng customMarkerLocationTwo = new LatLng(28.583078, 77.313744);
            LatLng customMarkerLocationThree = new LatLng(28.580903, 77.317408);
            LatLng customMarkerLocationFour = new LatLng(28.580108, 77.315271);

            //LatLngBound will cover all your marker on Google Maps
            LatLngBounds.Builder builder = new LatLngBounds.Builder();
            builder.include(customMarkerLocationOne); //Taking Point A (First LatLng)
            builder.include(customMarkerLocationThree); //Taking Point B (Second LatLng)
            LatLngBounds bounds = builder.build();
            CameraUpdate cu = CameraUpdateFactory.newLatLngBounds(bounds, 200);
            mMap.moveCamera(cu);
            mMap.animateCamera(CameraUpdateFactory.zoomTo(14), 2000, null);
        }
    });
}
Posted by: Guest on October-09-2021

Code answers related to "Creategoogle maps marker with custom image/bitmap"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language