I can able to fetch json response , added response in arraylist
When i try to compare 2 arraylist , arraylist2 value is not changing.
what i have done :
json parsing :
for (int i = 0; i < array.length(); i++) {
JSONObject obj = array.getJSONObject(i);
id = obj.getString("alert_id");
map.put("alert_id", id);
Log.d("map", map.toString());
arraylist1.add(map);
Log.e("asdasd", arraylist1.toString());
}
- Comparision :
for (int i = 0; i < arraylist.size(); i++) {
for (int j = 0; j < arraylist1.size(); j++) {
if (!(arraylist.get(i).get("id")).equals((arraylist1.get(j).get("id")))) {
//Checking whether the last value in the list..
if (j == (arraylist1.size() - 1)) {
unCommonList.add(arraylist.get(i).get("alert_id"));
} else {
}
}
}
}
-- Output :
92 79
91 79
86 79
85 79
84 79
81 79
80 79
-- Everytime arraylist2 remains same, arraylist1 is changing, but arraylist2 value is not
-- This is my arraylist2 :
[{abcd=100, id=79, createdate=2016-03-14 03:59:43, defge=2012310, 123123xyzw=alpha}, {abcd=11230, id=79, createdate=2016-03-14 03:59:43, defge=201231230, xyzw=alpasdha}, {abcd=10452430, id=79, createdate=2016-03-14 03:59:43, defge=12346, xyzw=alasdpha}, {abcd=1za00, id=79, createdate=2016-03-14 03:59:43, defge=212312300, xyzw=alpdsaha}, {abcd=112312300, id=79, createdate=2016-03-14 03:59:43, defge=21231200, xyzw=alpsqwha}, {abcd=123123, id=79, createdate=2016-03-14 03:59:43, defge=201231230, xyzw=alpqwreha}, {abcd=112312300, id=79, createdate=2016-03-14 03:59:43, defge=212312300, xyzw=alpyjha}, {abcd=101231230, id=79, createdate=2016-03-14 03:59:43, defge=200, xyzw=alpha}]