我遇到了json array
数据问题,我尝试了以下代码,我可以得到json response
完美的结果,但是listview
即使在响应中我也得到了单个数据,我也得到了单个项目,为什么?
这是代码:
URL = "some url";
HttpClient mHttpClient = new DefaultHttpClient();
HttpGet mGetMethod = new HttpGet(URL);
HttpResponse mReponseMessage = mHttpClient.execute(mGetMethod);
String Response = EntityUtils.toString(mReponseMessage.getEntity());
Log.d("TAG", "O/P Response is " + Response);
JSONArray responseObject = new JSONArray(Response);
System.out.println("responseObject="+responseObject);
for(int i=0; i<responseObject.length(); i++) {
obj = responseObject.getJSONObject(i);
}
这是我的 json 回复
[{"dmessage":"sfsfs","message":"sfsf","mp3":"Kalimba.mp3","user_message_id":"85","category":"Lottery","title":"dgfs"},{"dmessage":"prueba","message":"prueba","mp3":"NA","user_message_id":"80","category":"Lottery","title":"prueba"},{"dmessage":"prueba","message":"prueba","mp3":"NA","user_message_id":"79","category":"Lottery","title":"prueba"},
这里 obj 是response object
,在响应对象中,我也得到了单个值
谁能帮我解决这个问题谢谢!