Jd Akram
Jd Akram

Reputation: 47

Show custom image on google map marker in android

I am working on Google map in an Android app. I need to create a map marker with a custom image. I can parse the input to get a list of images, but can't figure out how to load one image into the marker object. I want to use asynchronous tasks to avoid exceptions in the network or main thread.

I've researched many links, but they are setting the image with a drawable. The result would be something like this:

[some thing like this

Upvotes: 2

Views: 2037

Answers (1)

Verma
Verma

Reputation: 8459

From Google Documentation

private static final LatLng MELBOURNE = new LatLng(-37.813, 144.962);
  private Marker melbourne = mMap.addMarker(new MarkerOptions()
                            .position(MELBOURNE)
                            .title("Melbourne")
                            .snippet("Population: 4,137,400")
                            .icon(BitmapDescriptorFactory.fromResource(R.drawable.arrow)));

Upvotes: 1

Related Questions