imagehandler

Converting image url to bitmap quickly

不打扰是莪最后的温柔 提交于 2019-12-09 06:22:20
问题 I need to display the list of images from api in the list page. For that i used two approaches. First Approach: By converting the url to byte array and then converting it into bitmap.Please find the below code.. URL imageUrl = new URL(url); URLConnection ucon = imageUrl.openConnection(); InputStream is = ucon.getInputStream(); BufferedInputStream bis = new BufferedInputStream(is); ByteArrayBuffer baf = new ByteArrayBuffer(500); int current = 0; while ((current = bis.read()) != -1) { /* This