how to load image from web?
hello all i have image url getting from web and now i want to display that in may imageview.开发者_运维技巧
pls helm me out.
Thanks In Advance.
Below i mentioned one function that will load image from web and convert it into drawable . So you can set that drawable into ImageView.
public static Drawable LoadImageFromWeb(String url)
{
try
{
InputStream is = (InputStream) new URL(url).getContent();
Drawable d = Drawable.createFromStream(is, "src name");
return d;
} catch (Exception e) {
return null;
}
}
精彩评论