0

I try to download image by URL but keep getting

D/skia: --- SkAndroidCodec::NewFromStream returned null

in logs. I assume this is because my URL is malformed. How do I download it correctly? This is how I'm downloading the image right now:

URL imageUrl = new URL("http://upload.wikimedia.org/wikipedia/commons/d/d5/YellowbilledLoon23.jpg");
Bitmap bmp = BitmapFactory.decodeStream(imageUrl.openConnection().getInputStream());

Edit: As CommonsWare suggested in the comments, the solution for me was changing URL from http to https.

SuperMario32
  • 70
  • 1
  • 1
  • 9

1 Answers1

0

Try this

URL imageUrl = new URL("https://upload.wikimedia.org/wikipedia/commons/d/d5/YellowbilledLoon23.jpg");
Bitmap bmp = BitmapFactory.decodeStream(imageUrl.openConnection().getInputStream());
compte14031879
  • 1,531
  • 14
  • 27