我下载一个JSON字符串,并将其转换成JSONArray。林把它变成一个列表视图,并需要能够从该列表视图后删除,因为JSONArray没有卸下摆臂方法(感谢奥巴马),我试图将其转换为一个ArrayList
下面是我的JSON(与Array.toString()):
[{thumb_url:TB-1370913834.jpg,事项标识:15,伯爵:44,event_tagline:这是一个标语,EVENT_NAME:5岁生日,event_end:1370919600,event_start:1370876400}]
我需要得到它到一个数组中,并能够通过各自的键来调用字符串。鸭preciate任何帮助!
解决方案 的ArrayList<字符串>的ListData =新的ArrayList<字符串>();
JSONArray jArray =(JSONArray),其中的JSONObject;
如果(jArray!= NULL){
的for(int i = 0; I< jArray.length();我++){
listdata.add(jArray.get(ⅰ)的ToString());
}
}
I am downloading a JSON string and converting it to JSONArray. Im putting it into a listview and need to be able to delete from that listview later, and since JSONArray has no .remove method (Thanks Obama), I am trying to convert it to an arraylist.
here is my JSON (the array.toString()):
[{"thumb_url":"tb-1370913834.jpg","event_id":"15","count":"44","event_tagline":"this is a tagline","event_name":"5th birthday","event_end":"1370919600","event_start":"1370876400"}]
I need to get it into an array and be able to call the strings by their respective keys. Appreciate any help!
解决方案ArrayList<String> listdata = new ArrayList<String>();
JSONArray jArray = (JSONArray)jsonObject;
if (jArray != null) {
for (int i=0;i<jArray.length();i++){
listdata.add(jArray.get(i).toString());
}
}
上一篇:执行失败的任务“:应用程序:dexDebug”。 com.android.ide.common.process.ProcessException:org.gradle.process.internal
下一篇:如何检测电源连接状态?电源、状态