I am using Google Maps Api and want to show an image inside InfoWindow when clicking of a Marker. I implemented it but there is a problem about Picasso. When I click a marke
What is working for me is this:
Inside getInfoWindow(Marker marker):
Picasso.with(getActivity())
.load(URL)
.error(R.drawable.my_loader)
.placeholder(R.drawable.my_loader)
.into(userPhoto, new MarkerCallback(marker,URL,userPhoto));
Then create a class:
public class MarkerCallback implements Callback {
Marker marker=null;
String URL;
ImageView userPhoto;
MarkerCallback(Marker marker, String URL, ImageView userPhoto) {
this.marker=marker;
this.URL = URL;
this.userPhoto = userPhoto;
}
@Override
public void onError() {
//Log.e(getClass().getSimpleName(), "Error loading thumbnail!");
}
@Override
public void onSuccess() {
if (marker != null && marker.isInfoWindowShown()) {
marker.hideInfoWindow();
Picasso.with(getActivity())
.load(URL)
.into(userPhoto);
marker.showInfoWindow();
}
}
}