Пример #1
0
  /**
   * @param content
   * @return 评论
   */
  public static List<VideoBean> parse_pinlun(String content) {

    List<VideoBean> dates = new ArrayList<VideoBean>();
    try {
      JSONObject jsonobject = new JSONObject(content);
      JSONArray ja = new JSONArray(jsonobject.getString("data"));

      for (int i = 0; i < ja.length(); i++) {
        VideoBean vipRoomBean = new VideoBean();

        JSONObject jsonobject2 = ja.getJSONObject(i).getJSONObject("identityBase");
        vipRoomBean.identityTitle = jsonobject2.getString("identityTitle");
        vipRoomBean.myLogo = jsonobject2.optString("myLogo");
        vipRoomBean.aboutMe = jsonobject2.optString("aboutMe");
        vipRoomBean.verified = jsonobject2.optInt("verified");
        vipRoomBean.isDefault = jsonobject2.optBoolean("isDefault");
        vipRoomBean.userId = jsonobject2.optInt("userId");

        vipRoomBean.identityId = jsonobject2.optLong("identityId");
        vipRoomBean.followingNum = jsonobject2.optInt("followingNum");
        vipRoomBean.followedNum = jsonobject2.optInt("followedNum");
        vipRoomBean.speakCount = jsonobject2.optInt("speakCount");
        vipRoomBean.autoFollowing = jsonobject2.optInt("autoFollowing");
        vipRoomBean.autoFollowed = jsonobject2.optInt("autoFollowed");
        vipRoomBean.displayName = jsonobject2.optString("displayName");
        vipRoomBean.viewCount = jsonobject2.optInt("viewCount");

        JSONObject jsonobject3 = ja.getJSONObject(i).getJSONObject("onlineTeachComment");
        vipRoomBean.speakId = jsonobject3.optInt("speakId");
        vipRoomBean.commentId = jsonobject3.optInt("commentId");
        vipRoomBean.createTime = jsonobject3.optLong("createTime");
        vipRoomBean.content = jsonobject3.optString("content");
        vipRoomBean.annotations = jsonobject3.optString("annotations");
        vipRoomBean.audioId = jsonobject3.optString("audioUrl");

        dates.add(vipRoomBean);
      }
      return dates;
    } catch (JSONException e) {
      e.printStackTrace();
    }
    return dates;
  }