如何过滤 JSON 列表视图
How can I filter JSON listview
我想要在列表中显示的是 equals(London)
中的字符串:
String location = respons.getString("location");
如果它等于曼彻斯特,我不希望它出现在列表中:
for (int i = 0; i < jsonArray.length(); i++) {
JSONObject respons =jsonArray.getJSONObject(i);
String id = respons.getString("id");
String location = respons.getString("location");
String info = respons.getString("name");
String img = respons.getString("img");
listitmes.add(new Listitme(id, location, info, img));
listAllItme();
}
JSONObject respons =jsonArray.getJSONObject(i);
// do your test hire if respons.getString("location") equlas the String "manchestar"
if(respons.getString("location").equlas("manchestar")){
String id=respons.getString("id");
String info=respons.getString("name");
String img=respons.getString("img");
listitmes.add(new Listitme(id,location,info,img));
listAllItme();
}
我想要在列表中显示的是 equals(London)
中的字符串:
String location = respons.getString("location");
如果它等于曼彻斯特,我不希望它出现在列表中:
for (int i = 0; i < jsonArray.length(); i++) {
JSONObject respons =jsonArray.getJSONObject(i);
String id = respons.getString("id");
String location = respons.getString("location");
String info = respons.getString("name");
String img = respons.getString("img");
listitmes.add(new Listitme(id, location, info, img));
listAllItme();
}
JSONObject respons =jsonArray.getJSONObject(i);
// do your test hire if respons.getString("location") equlas the String "manchestar"
if(respons.getString("location").equlas("manchestar")){
String id=respons.getString("id");
String info=respons.getString("name");
String img=respons.getString("img");
listitmes.add(new Listitme(id,location,info,img));
listAllItme();
}