I am using the google maps utility demo code and changing the use of Picasso to upload an image.
My question is this:
Picasso cannot upload image and use placeholder image

After zooming in and out, update the marker. Image can be uploaded

My question is with this Google Map V2 Lazy loading marker image
But I can not get help from the answer I am stuck on Bitmap bitmap = thumbCache.get(url);
. I am also trying to execute a Picasso onSuccess callback, but I can also suck it.
How to update the manufacturer icon when loading the url is complete? I can use another URL image downloader library.
private class PersonRenderer extends DefaultClusterRenderer<Person> {
private final IconGenerator mIconGenerator = new IconGenerator(getApplicationContext());
private final IconGenerator mClusterIconGenerator = new IconGenerator(getApplicationContext());
private final ImageView mImageView;
private final ImageView mClusterImageView;
private final int mDimension;
public PersonRenderer() {
super(getApplicationContext(), getMap(), mClusterManager);
View multiProfile = getLayoutInflater().inflate(R.layout.multi_profile, null);
mClusterIconGenerator.setContentView(multiProfile);
mClusterImageView = (ImageView) multiProfile.findViewById(R.id.image);
mImageView = new ImageView(getApplicationContext());
mDimension = (int) getResources().getDimension(R.dimen.custom_profile_image);
mImageView.setLayoutParams(new ViewGroup.LayoutParams(mDimension, mDimension));
int padding = (int) getResources().getDimension(R.dimen.custom_profile_padding);
mImageView.setPadding(padding, padding, padding, padding);
mIconGenerator.setContentView(mImageView);
}
@Override
protected void onBeforeClusterItemRendered(Person person, MarkerOptions markerOptions) {
Picasso.with(getApplicationContext())
.load(person.profileUrl)
.placeholder(R.drawable.ic_launcher)
.error(R.drawable.ic_launcher)
.resize(64, 64)
.centerCrop()
.into(mImageView);
Bitmap icon = mIconGenerator.makeIcon();
markerOptions.icon(BitmapDescriptorFactory.fromBitmap(icon)).title(person.name);
}
@Override
protected void onBeforeClusterRendered(Cluster<Person> cluster, MarkerOptions markerOptions) {
List<Drawable> profilePhotos = new ArrayList<Drawable>(Math.min(4, cluster.getSize()));
int width = mDimension;
int height = mDimension;
for (Person p : cluster.getItems()) {
if (profilePhotos.size() == 4) break;
ImageView cImageView = new ImageView(getBaseContext());
Picasso.with(getApplicationContext())
.load(p.profileUrl)
.placeholder(R.drawable.ic_launcher)
.error(R.drawable.ic_launcher)
.resize(64, 64)
.centerCrop()
.into(cImageView);
Drawable drawable = cImageView.getDrawable();
drawable.setBounds(0, 0, width, height);
profilePhotos.add(drawable);
}
MultiDrawable multiDrawable = new MultiDrawable(profilePhotos);
multiDrawable.setBounds(0, 0, width, height);
mClusterImageView.setImageDrawable(multiDrawable);
Bitmap icon = mClusterIconGenerator.makeIcon(String.valueOf(cluster.getSize()));
markerOptions.icon(BitmapDescriptorFactory.fromBitmap(icon));
}