public CommentsGetInfoResponseBean(String response) { super(response); // TODO Auto-generated constructor stub if (response == null) { return; } try { JSONObject obj = new JSONObject(response); JSONArray array = obj.optJSONArray(CommentInfo.KEY_COMMENTS); if (array != null) { comments = new ArrayList<CommentInfo>(); int size = array.length(); for (int i = 0; i < size; i++) { CommentInfo info = new CommentInfo(); info.parse(array.optJSONObject(i)); if (info != null) { comments.add(info); } } } } catch (JSONException e) { e.printStackTrace(); } catch (NetworkException e) { e.printStackTrace(); } }
@Override public String toString() { StringBuffer sb = new StringBuffer(); if (comments != null) { for (CommentInfo info : comments) { sb.append(info.toString()).append("\r\n"); } } return sb.toString(); }