• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps ImageView from URL

davidkebo

Lurker
Nov 3, 2009
7
2
Hello,
Im trying to display a url image in an ImageView container on the screen.
I see the image, but sometimes the application crashes. I am wondering if im using the stream properly.
Code:
URL url = new URL("http://192.168.1.111/jpg/image.jpg");
InputStream stream = url.openStream();
Bitmap bmp = BitmapFactory.decodeStream(stream);
stream.close();
myImageView.setImageBitmap(bmp);

Any help or suggestions ?
Thanks
 

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones