Saturday, November 17, 2018

Android: Marker with an image

Below is how to display a marker with a custom image. But this is going to just display the image as is given. Not with any marker like pointed.

public void updateMapWithUserLocations(){
        mSydney = mMap.addMarker(new MarkerOptions()
                .position(new LatLng(12.841747, 77.651758))
                .title("Sydney")
                .snippet("Population: 4,627,300")
                .icon(BitmapDescriptorFactory.fromResource(R.drawable.dummy_profile_img)));
        mMap.moveCamera(CameraUpdateFactory.newLatLng(new LatLng(12.841747, 77.651758)));
    }

No comments:

Post a Comment