-3
在jsone沒有價值,我收到:遠程圖像未加載。對於profilePic JSONException
"profilePic":"http:\/\/api.androidhive.info\/feed\/img\/nat.jpg","image":"\/images\/1491410855.JPG"
如何使用setImageUrl()
它轉換成普通URL在ImageView的設置?
在jsone沒有價值,我收到:遠程圖像未加載。對於profilePic JSONException
"profilePic":"http:\/\/api.androidhive.info\/feed\/img\/nat.jpg","image":"\/images\/1491410855.JPG"
如何使用setImageUrl()
它轉換成普通URL在ImageView的設置?
但是,由於您看到轉義字符,因此您會打印/收集JSON不正確。
例如,這source
{
"feed": [
{
"id": 1,
"name": "National Geographic Channel",
"image": "http://api.androidhive.info/feed/img/cosmos.jpg",
"status": "\"Science is a beautiful and emotional human endeavor,\" says Brannon Braga, executive producer and director. \"And Cosmos is all about making science an experience.\"",
"profilePic": "http://api.androidhive.info/feed/img/nat.jpg",
"timeStamp": "1403375851930",
"url": null
},
嘗試使用凌空JsonObjectRequest
然後,
JSONArray feed = response.getJSONArray("feed");
for (int i = 0; i < feed.length(); i++) {
JSONObject feedObj = feed.getJSONObjet(i);
String profilePic = feedObj.getString("profilePic");
// Picasso.load(profilePic).into(imageView); // for example
}
你應該使用一個庫如畢加索上設置的圖像imageview – Eenvincible
那我是一個正常的URL與轉義字符...修復生成該JSON的服務器 –
我曾嘗試使用'.replaceAll(「\\\\」,「」)''它對我有用。 –