use of com.google.gson.JsonSyntaxException in project weiciyuan by qii.
the class ModifyGroupMemberDao method executeTask.
private UserBean executeTask(String url) throws WeiboException {
Map<String, String> map = new HashMap<String, String>();
map.put("access_token", access_token);
map.put("uid", uid);
map.put("list_id", list_id);
String jsonData = HttpUtility.getInstance().executeNormalTask(HttpMethod.Post, url, map);
Gson gson = new Gson();
UserBean value = null;
try {
value = gson.fromJson(jsonData, UserBean.class);
} catch (JsonSyntaxException e) {
AppLogger.e(e.getMessage());
}
return value;
}
use of com.google.gson.JsonSyntaxException in project weiciyuan by qii.
the class UpdateGroupNameDao method update.
public GroupBean update() throws WeiboException {
String url = URLHelper.GROUP_UPDATE;
Map<String, String> map = new HashMap<String, String>();
map.put("access_token", access_token);
map.put("name", name);
map.put("list_id", list_id);
String jsonData = HttpUtility.getInstance().executeNormalTask(HttpMethod.Post, url, map);
Gson gson = new Gson();
GroupBean value = null;
try {
value = gson.fromJson(jsonData, GroupBean.class);
} catch (JsonSyntaxException e) {
AppLogger.e(e.getMessage());
}
return value;
}
use of com.google.gson.JsonSyntaxException in project weiciyuan by qii.
the class StatusesTimeLineDao method getGSONMsgList.
public MessageListBean getGSONMsgList() throws WeiboException {
String url = URLHelper.STATUSES_TIMELINE_BY_ID;
Map<String, String> map = new HashMap<String, String>();
map.put("access_token", access_token);
map.put("uid", uid);
map.put("since_id", since_id);
map.put("max_id", max_id);
map.put("count", count);
map.put("page", page);
map.put("screen_name", screen_name);
map.put("base_app", base_app);
map.put("feature", feature);
map.put("trim_user", trim_user);
String jsonData = HttpUtility.getInstance().executeNormalTask(HttpMethod.Get, url, map);
Gson gson = new Gson();
MessageListBean value = null;
try {
value = gson.fromJson(jsonData, MessageListBean.class);
} catch (JsonSyntaxException e) {
AppLogger.e(e.getMessage());
}
if (value != null && value.getSize() > 0) {
for (MessageBean b : value.getItemList()) {
TimeUtility.dealMills(b);
TimeLineUtility.addJustHighLightLinks(b);
}
}
return value;
}
use of com.google.gson.JsonSyntaxException in project weiciyuan by qii.
the class AtUsersDBTask method get.
public static List<AtUserBean> get(SQLiteDatabase db, String accountId) {
List<AtUserBean> msgList = new ArrayList<AtUserBean>();
String sql = "select * from " + AtUsersTable.TABLE_NAME + " where " + AtUsersTable.ACCOUNTID + " = " + accountId + " order by " + AtUsersTable.ID + " desc";
Cursor c = db.rawQuery(sql, null);
Gson gson = new Gson();
while (c.moveToNext()) {
String json = c.getString(c.getColumnIndex(AtUsersTable.JSONDATA));
try {
AtUserBean value = gson.fromJson(json, AtUserBean.class);
msgList.add(value);
} catch (JsonSyntaxException e) {
AppLogger.e(e.getMessage());
}
}
c.close();
return msgList;
}
use of com.google.gson.JsonSyntaxException in project weiciyuan by qii.
the class CommentByMeTimeLineDBTask method updatePosition.
private static void updatePosition(TimeLinePosition position, String accountId) {
String sql = "select * from " + CommentByMeTable.TABLE_NAME + " where " + CommentByMeTable.ACCOUNTID + " = " + accountId;
Cursor c = getRsd().rawQuery(sql, null);
Gson gson = new Gson();
if (c.moveToNext()) {
try {
String[] args = { accountId };
ContentValues cv = new ContentValues();
cv.put(CommentByMeTable.TIMELINEDATA, gson.toJson(position));
getWsd().update(CommentByMeTable.TABLE_NAME, cv, CommentByMeTable.ACCOUNTID + "=?", args);
} catch (JsonSyntaxException e) {
}
} else {
ContentValues cv = new ContentValues();
cv.put(CommentByMeTable.ACCOUNTID, accountId);
cv.put(CommentByMeTable.TIMELINEDATA, gson.toJson(position));
getWsd().insert(CommentByMeTable.TABLE_NAME, CommentByMeTable.ID, cv);
}
}
Aggregations