开发者

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;
    }
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜