I\'m trying to show my news in a custom ListView. Each news is included of some images and I want to
Custom target for storing photo in phone gallery.
public class TargetPhoneGallery implements Target
{
private final WeakReference resolver;
private final String name;
private final String desc;
public TargetPhoneGallery(ContentResolver r, String name, String desc)
{
this.resolver = new WeakReference(r);
this.name = name;
this.desc = desc;
}
@Override
public void onPrepareLoad (Drawable arg0)
{
}
@Override
public void onBitmapLoaded (Bitmap bitmap, LoadedFrom arg1)
{
ContentResolver r = resolver.get();
if (r != null)
{
MediaStore.Images.Media.insertImage(r, bitmap, name, desc);
}
}
@Override
public void onBitmapFailed (Drawable arg0)
{
}
}
Picasso.with(context).load(image[position]).into(new TargetPhoneGallery(view.getContentResolver(), "image name", "image desc"));