I would like to use Picasso to retrieve the Bitmap image to use as a marker icon but I am not sure how to do so. If I am using Picasso to insert an image into an image view, I know I can use:
Picasso.with(MainActivity.this).load(URL).into(photo_imageview);
Of course this will not work if I pass it to .icon()
Is there a simple way to achieve this?
Thanks to anyone taking a look at this!
Check this google maps sample code, you can find a
InfoWindowAdapter
implementation to achieve it : googlemaps/android-samplesPicasso provides a generic
Target
interface you can use to implement your own image destination. Specifically, you will want to overrideonBitmapLoaded
to populate your marker.A basic implementation is given below.
You would use it like this --
Note Picasso only holds a week reference to the
Target
passed tointo
. Therefore, themarker
reference needs to exist until the image is loaded to avoid have the callbacks being cleaned up by the garbage collector.