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

后端 未结 9 1306
北恋
北恋 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:49

    Try this:

    HttpGet httpRequest = new HttpGet(url);
    HttpClient httpclient = new DefaultHttpClient();
    HttpResponse response = (HttpResponse) httpclient.execute(httpRequest);
    HttpEntity entity = response.getEntity();
    BufferedHttpEntity bufferedHttpEntity = new BufferedHttpEntity(entity);
    InputStream is = bufferedHttpEntity.getContent();
    Drawable d = Drawable.createFromStream(is, "");
    //or bitmap
    //Bitmap b = BitmapFactory.decodeStream(is);
    

提交回复
热议问题