hiii,
I am working on a project where i am calling a url and fetching data as json . Now , this json object will be parsed.
Now i am getting a json tag like status= active or status = notActive.
Based on this response , i have to place some data tags which have a status "Active" under group title "Active" under listview and notActive data under "NOT-ACTIVE" group title.
*How to different data based on status value under two groups seperately so that when i click Active group , i will ge*t different data for Active only .
Any kind of help will be highly appreciat开发者_高级运维ed....
This way i solved it.
try{
jArray = new JSONArray(json);
for(int i=0;i<jArray.length() ;i++){
Map<String, String> childdata1 = new HashMap<String, String>();
JSONObject e = jArray.getJSONObject(i);
String status = e.getString("2");
// Log.e("log_tag","Status: "+status);
if (status.contains("active")){
// Log.e("log_tag","StatusActive: "+status);
//childdata1.put("child", String.valueOf(i));
childdata1.put("child", e.getString("mlsid"));
childdata1.put("child1", e.getString("status"));
childdata1.put("child2", e.getString("address"));
childdata1.put("child3", e.getString("city"));
child1.add(childdata1);
}else if(status.contains("pending")){
//Log.e("log_tag","StatusPending: "+status);
Map<String, String> childdata2= new HashMap<String, String> ();
// childdata2.put("0", String.valueOf(i));
childdata2.put("child", e.getString("mlsid"));
childdata2.put("child1", e.getString("status"));
childdata2.put("child2", e.getString("address"));
childdata2.put("child3", e.getString("city"));
child2.add(childdata2);
}
}
// Log.e("log_tag","ARRAY Length : "+jArray.length());
}catch(JSONException e) {
Log.e("log_tag", "Error parsing data "+e.toString());
精彩评论