我研究了从服务器检索 json 数据并显示在我的应用程序中的简单应用程序。我正在使用此链接获取数据,json 数据
我的代码如下,
Ion.with(this)
.load("http://marketplace.envato.com/api/edge/search:audiojungle,,happy.json")
.asString().setCallback(new FutureCallback<String>() {
@Override
public void onCompleted(Exception arg0, String data) {
// TODO Auto-generated method stub
try {
JSONObject jObject = new JSONObject(data);
JSONArray jArray = jObject.getJSONArray("search");
for (int i = 0; i < jArray.length(); i++) {
JSONObject jObject_0 = jArray.getJSONObject(i);
JSONObject jObj = jObject_0
.getJSONObject("item_info");
cost.setText(jObj.getString("cost"));
item.setText(jObj.getString("item"));
user.setText(jObj.getString("user"));
preview_value.setText(jObj
.getString("preview_type"));
length.setText(jObj.getString("length"));
String s = jObj.getString("thumbnail");
Ion.with(getBaseContext()).load(s).withBitmap()
.intoImageView(image);
Log.d("item", item.toString());
}
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
});
我想根据列表数据显示多个数据。bt 每次都获得相同的最后数据并将其设置到组件中。那么如何获取相同json对象的多个值。请帮我。谢谢你。