use of com.google.gson.JsonSyntaxException in project weiciyuan by qii.
the class GroupListDao method getInfo.
public List<String> getInfo() throws WeiboException {
String url = URLHelper.GROUP_MEMBER_LIST;
Map<String, String> map = new HashMap<String, String>();
map.put("access_token", access_token);
map.put("uids", uids);
String jsonData = HttpUtility.getInstance().executeNormalTask(HttpMethod.Get, url, map);
Gson gson = new Gson();
List<GroupUser> value = null;
try {
value = gson.fromJson(jsonData, new TypeToken<List<GroupUser>>() {
}.getType());
} catch (JsonSyntaxException e) {
AppLogger.e(e.getMessage());
}
if (value != null && value.size() > 0) {
GroupUser user = value.get(0);
List<String> ids = new ArrayList<String>();
for (GroupBean b : user.lists) {
ids.add(b.getIdstr());
}
return ids;
}
return null;
}
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;
}
Aggregations