2012-03-30 131 views
0

我在做一個項目中,我必須讓從web服務器的圖像,數據存儲在JSON格式。我有一個json網址,我必須從服務器獲取名稱和圖像url,然後從服務器獲取位圖圖像。解析JSON鏈接以獲取圖像

誰能幫我做這個。 謝謝。

回答

0

使用此代碼用於獲取圖像繪製表格網址

public Object fetch(String address) throws MalformedURLException, IOException { 

    URL url = new URL(address); 
    Object content = url.getContent(); 
    return content; 
} 

private Drawable ImageOperations(Context ctx, String url) { 

    try { 
     InputStream is = (InputStream) this.fetch(url); 
     Drawable d = Drawable.createFromStream(is, "src"); 
     return d; 
    } catch (MalformedURLException e) { 
     return null; 
    } catch (IOException e) { 
     return null; 
    } 
}