D / skia (1252): --- SkImageDecoder :: Factory returns a null error

I use the following code to download an image from the Internet and show it in Android ImageView.

private class DownloadImage extends AsyncTask<String, Void, Bitmap> {

    @Override
    protected Bitmap doInBackground(String... arg) {
        Bitmap bmp = null;
        try {
            URL url = new URL(arg[0]);
            bmp = BitmapFactory.decodeStream(url.openConnection()
                    .getInputStream());

        } catch (MalformedURLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return bmp;

    }

    @Override
    protected void onPostExecute(Bitmap result) {
        adImg.setImageBitmap(result);
        super.onPostExecute(result);
    }
}

However, the code leads to an error D/skia(1252): --- SkImageDecoder::Factory returned null.

What could be the problem?

+3
source share
1 answer

There are my reasons why this is happening. main question i found:

  • URL - Additional permissions may be required to access the image.

  • Url To access the image you need the HTTP get method

  • The image will be large

0
source

All Articles