Paolino Angeletti
Lurker
I'm triyng to download an image from an URL (https://images-eu.ssl-images-amazon.com/images/I/21Miz0XtoZL.jpg) and I want to convert the downloaded resources into Bitmap. I'm using this piece of code:
java.net.URL url = new java.net.URL(src);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setDoInput(true);
connection.connect();
InputStream input = connection.getInputStream();
Bitmap myBitmap = BitmapFactory.decodeStream(input);
return myBitmap;
but the resulted bitmap is this:https://i.stack.imgur.com/hhBny.png
Generally this code work very fine, but on this image not. How can I solve this issue without change all the code or insert new libraries? Thanks.
java.net.URL url = new java.net.URL(src);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setDoInput(true);
connection.connect();
InputStream input = connection.getInputStream();
Bitmap myBitmap = BitmapFactory.decodeStream(input);
return myBitmap;
but the resulted bitmap is this:https://i.stack.imgur.com/hhBny.png
Generally this code work very fine, but on this image not. How can I solve this issue without change all the code or insert new libraries? Thanks.