public ArrayList<TitleEntity> getListEntity(String json) throws Exception { ArrayList<TitleEntity> list = new ArrayList<TitleEntity>(); JSONObject obj = new JSONObject(json); JSONArray array1 = obj.getJSONArray("data"); for (int i = 0; i < array1.length(); i++) { JSONObject obj1 = (JSONObject) array1.get(i); TitleEntity entity = new TitleEntity(); entity.setTitleName(obj1.optString("columnname")); entity.setTitleid(obj1.optString("id")); entity.setTilteIndex(obj1.optInt("index")); list.add(entity); } return list; }
@Override public int compareTo(TitleEntity another) { // TODO Auto-generated method stub return this.getTilteIndex().compareTo(another.getTilteIndex()); }