user836026
user836026

Reputation: 11362

Using icon marker that will be retrived from "URL" instead of saved icon on Google Maps

I'm trying to display marker on Google map. I can do this using a saved icon, for example: Drawable drawable = this.getResources().getDrawable(R.drawable.androidmarker);

however, the chanllange is, i need to use icon that will be retrived from URL. like "icon": "http://maps.gstatic.com/mapfiles/place_api/icons/generic_business-71.png",

any idea how i can do this?

Upvotes: 1

Views: 862

Answers (2)

BonanzaDriver
BonanzaDriver

Reputation: 6452

Check out the BitmapFactory.decodeStream() ... passing in the URL.getImputStream() for the image you want to use during runtime.

Lots of examples of this on the net.

Upvotes: 1

Estel
Estel

Reputation: 2204

It's probably best to download the image from the URL, save it locally and then generate the drawable from that local resource.

Upvotes: 2

Related Questions