BitmapFactory.decodeStream always returns null and skia decoder shows decode returned false

后端 未结 9 1325
北恋
北恋 2020-12-09 06:50

test image here: http://images.plurk.com/tn_4134189_bf54fe8e270ce41240d534b5133884ee.gif

I\'ve tried several solutions found on the internet but there is no working

9条回答
  •  醉酒成梦
    2020-12-09 07:32

    This should work:

    URL url = new URL(src);
    HttpURLConnection connection = (HttpURLConnection) url.openConnection();
    connection.setDoInput(true);
    connection.connect();
    InputStream input = connection.getInputStream();
    Bitmap myBitmap = BitmapFactory.decodeStream(input);
    connection.disconnect();
    input.close();
    

    myBitmap contains your image.

提交回复
热议问题