hey i want to sort item from the new to the old by id from json i want the new item to apear on the top of the list i am using this code
try {
JSONObject mainJson = new JSONObject(result);
JSONArray jsonArray = mainJson.getJSONArray(Constant.ARRAY_NAME);
JSONObject objJson = null;
for (int i = 0; i < jsonArray.length(); i++) {
objJson = jsonArray.getJSONObject(i);
ItemWallpaper objItem = new ItemWallpaper();
objItem.setWallId(objJson.getString(Constant.WALL_ID));
objItem.setWallImage(objJson.getString(Constant.WALL_IMAGE));
arrayOfLatestImage.add(objItem);
}
} catch (JSONException e) {
e.printStackTrace();
}
for(int j=0;j<arrayOfLatestImage.size(); j++)
{
objAllBean=arrayOfLatestImage.get(j);
allListImage.add(objAllBean.getWallImage());
allArrayImage=allListImage.toArray(allArrayImage);
allListId.add(objAllBean.getWallId());
allArrayId=allListId.toArray(allArrayId);
}