how to load bitmap directly with picasso library like following

Sachin Mandhare picture Sachin Mandhare · Jan 6, 2016 · Viewed 21.1k times · Source
Picasso.with(context).load("url").into(imageView);

Here instead of url i want bitmap how can i achieve this. like below-

Picasso.with(context).load(bitmap).into(imageView);

Answer

Vit picture Vit · Jan 6, 2016

This should work for you. Use the returned URI with Picasso.

(taken from: is there away to get uri of bitmap with out save it to sdcard?)

public Uri getImageUri(Context inContext, Bitmap inImage) {
    ByteArrayOutputStream bytes = new ByteArrayOutputStream();
    inImage.compress(Bitmap.CompressFormat.JPEG, 100, bytes);
    String path = MediaStore.Images.Media.insertImage(inContext.getContentResolver(), inImage, "Title", null);
    return Uri.parse(path);
}