Android how to display and image from URL
I'm having trouble displaying SOME images on my android app. Just normal display image from certain URL. Some images works, some jus开发者_Python百科t doesn't work. For instance try displaying this image from URL:
http://img191.imageshack.us/img191/7379/tronlegacys7i7wsjf.jpg
It doesn't work. Doesn't even work in emulator.
Could it be the EXIF info for the image is problematic? Can anyone try to see they are able to display that image on android app, and share the code/method to display that image on screen?
Thank you!
Or you can try this ImageDownloader class from google. It´s works nice :) Is an AsynkTask that handle the download and set the bitmap to an ImageView.
ImageDownloader
Usage:
private final ImageDownloader mDownload = new ImageDownloader();
mDownload.download("URL", imageView);
You will have no problems displayin that image in a webview
WebView myWebView = (WebView) findViewById(R.id.webview);
myWebView.loadUrl("http://img191.imageshack.us/img191/7379/tronlegacys7i7wsjf.jpg");
where are your image being displayed?
Make sure you have <uses-permission android:name="android.permission.INTERNET" />
in your AndroidManifest.xml. What code are you using to load the image?
精彩评论