Thursday, 15 March 2012

android - How to load a Bitmap with Picasso without using an ImageView? -



android - How to load a Bitmap with Picasso without using an ImageView? -

with imageview, can utilize next code download image callback

picasso.with(activity).load(url).into(imageview, new callback() { @override public void onsuccess() { // } @override public void onerror() { } );

or bitmap picasso.with(activity).load(url).get();. there anyway add together callback download image? if possible please provide sample code, cheers!

you can create a target , handle bitmap within targets callback methods.

this how:

// create sure set target strong reference private target loadtarget; public void loadbitmap(string url) { if (loadtarget == null) loadtarget = new target() { @override public void onbitmaploaded(bitmap bitmap, picasso.loadedfrom from) { // bitmap handleloadedbitmap(bitmap); } @override public void onbitmapfailed() { } }; picasso.with(this).load(url).into(loadtarget); } public void handleloadedbitmap(bitmap b) { // here }

android android-imageview picasso android-bitmap

No comments:

Post a Comment