android - Converting base64 into bitmap and loading into recycler view -
i'm trying convert base64 image bitmap image , load using picasso library recycler view. however, error whenever run code saying need pass in uri picasso method.
public string getimage(){ context context =null; byte[] decodedstring = base64.decode(image, base64.url_safe); bitmap decodedbyte = bitmapfactory.decodebytearray(decodedstring, 0, decodedstring.length); bytearrayoutputstream bytes = new bytearrayoutputstream(); decodedbyte.compress(bitmap.compressformat.png, 100, bytes); path = mediastore.images.media.insertimage(context.getcontentresolver(), decodedbyte, null, null); return uri.parse(path); }
dataadapter:
picasso.with(context).load(data.get(i).getimage()).into(holder.reportimage);
once have downloaded , decoded bitmap, there no point of using image loading library. of benefits (request queue , cache) lost. can use holder.reportimage.setimagebitmap(bmp);
another approach write custom requesthandler
, decode base64 data after downloading.
Comments
Post a Comment