BitmapFactory.decodeStream returning null when options are set

前端 未结 4 409
北海茫月
北海茫月 2020-11-27 12:53

I\'m having issues with BitmapFactory.decodeStream(inputStream). When using it without options, it will return an image. But when I use it with options as in

4条回答
  •  有刺的猬
    2020-11-27 13:31

    Try wrap InputStream with BufferedInputStream.

    InputStream is = new BufferedInputStream(conn.getInputStream());
    is.mark(is.available());
    // Do the bound decoding
    // inJustDecodeBounds =true
    is.reset();  
    // Do the actual decoding
    

提交回复
热议问题