try {
JSONObject jsonObj = new JSONObject(jsonResult);
JSONArray array = jsonObj.getJSONArray("statuses");
for(int i=0;i<array.length();i++)
{
WeiboPost p = new WeiboPost();
JSONObject tmp = array.getJSONObject(i);
p.setCreatedAt(tmp.optString("created_at"));
p.setId(tmp.optString("id"));
p.setContent(tmp.optString("text"));
p.setOAuthUID(uid);
p.setUrl(tmp.optString("source"));
//TODO retweeted_status 是原帖
if( !tmp.isNull("retweeted_status"))
{
JSONObject retweeted_status = tmp.getJSONObject("retweeted_status");
if(retweeted_status!=null)
{
WeiboPost retweeted = new WeiboPost();
retweeted.setId(retweeted_status.optString("id"));
retweeted.setContent(retweeted_status.optString("text"));
JSONObject originalUser = retweeted_status.getJSONObject("user");
if(originalUser!=null)
{
retweeted.setOAuthUID(originalUser.optString("id"));
retweeted.setScreenName(originalUser.optString("screen_name"));
}
p.setRetweeted(retweeted);
}
}
result.add(p);