2016-07-26 146 views
-2

我以這種方式得到了JSON數據:顯示圖像的Android應用程序

{"data":[{"img_name":"abc.jpeg","img_path":"6"}]} 

現在我怎樣才能顯示圖像視圖這一形象在我的Android application.Please幫我解決。

+0

圖像在哪裏?本地,網絡? – adalPaRi

+0

使用圖片加載器https://www.simplifiedcoding.net/android-custom-listview-with-images-using-recyclerview-and-volley/ – vinoth12594

+0

發佈一些細節.... – Aspicas

回答

0

不知道這是你想要的。

首先,您需要解析JSON並獲取img_pathimg_name。然後你可以創建圖像的網址。網址生成邏輯取決於您的服務器邏輯。

這樣的事情,

JSONObject data = new JSONObject(your_json_data); 
String img_path = data.getString("img_path"); 
String img_name = data.getString("img_name"); 

String url = "http://xxx.xxx.x.x/" + img_path + "/" + img_name; 

使用像畢加索的ImageLoader的加載圖像。

+0

非常感謝。幾乎相同。在這裏使用url http://xxx.xxx.x.ximage.php。當我運行這段代碼時,我得到了那個Json result.Where我應該寫這個PHP路徑來顯示圖像嗎? – user6588225

+0

使用類似上面代碼中顯示的url變量的臨時變量。 –

+0

我明白了,謝謝你:) – user6588225

相關問題