use of org.qii.weiciyuan.bean.android.MyStatusTimeLineData in project weiciyuan by qii.
the class MyStatusDBTask method get.
public static MyStatusTimeLineData get(String accountId) {
Gson gson = new Gson();
MessageListBean result = new MessageListBean();
List<MessageBean> msgList = new ArrayList<MessageBean>();
String sql = "select * from " + MyStatusTable.StatusDataTable.TABLE_NAME + " where " + MyStatusTable.StatusDataTable.ACCOUNTID + " = " + accountId + " order by " + MyStatusTable.StatusDataTable.MBLOGID + " desc limit 50";
Cursor c = getRsd().rawQuery(sql, null);
while (c.moveToNext()) {
String json = c.getString(c.getColumnIndex(MyStatusTable.StatusDataTable.JSONDATA));
try {
MessageBean value = gson.fromJson(json, MessageBean.class);
if (!value.isMiddleUnreadItem()) {
value.getListViewSpannableString();
}
msgList.add(value);
} catch (JsonSyntaxException ignored) {
}
}
result.setStatuses(msgList);
c.close();
return new MyStatusTimeLineData(result, getPosition(accountId));
}
Aggregations