use of org.qii.weiciyuan.bean.TagBean in project weiciyuan by qii.
the class FriendsTimeLineTagDao method getGSONMsgList.
public List<TagBean> getGSONMsgList() throws WeiboException {
String json = getMsgListJson();
List<TagBean> tagBeanList = new ArrayList<TagBean>();
try {
JSONArray array = new JSONArray(json);
int size = array.length();
for (int i = 0; i < size; i++) {
TagBean bean = new TagBean();
JSONObject jsonObject = array.getJSONObject(i);
Iterator<String> iterator = jsonObject.keys();
while (iterator.hasNext()) {
String key = iterator.next();
if (key.equalsIgnoreCase("weight")) {
String value = jsonObject.optString(key);
bean.setWeight(value);
} else {
String value = jsonObject.optString(key);
bean.setId(Integer.valueOf(key));
bean.setName(value);
}
}
tagBeanList.add(bean);
}
} catch (JSONException e) {
AppLogger.e(e.getMessage());
}
return tagBeanList;
}
Aggregations