I’m using the following function to load a remote image to an ImageView. The image definitely exists at the URL I’m trying to load it from but when I call to the function and try to display the image the ImageView remains blank.
public static void setImage(ImageView view, String url) throws IOException {
final URLConnection conn = new URL(url).openConnection();
conn.connect();
final InputStream is = conn.getInputStream();
final BufferedInputStream bis = new BufferedInputStream(is, 100000);
final Bitmap bm = BitmapFactory.decodeStream(bis);
bis.close();
is.close();
view.setImageBitmap(bm);
}
this worked for me: