Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I Solved this I had to design nested getter and setter according to the JSON provided by facebook.Added two <code>ArrayList</code> in getter setter class.</p> <pre><code> public List&lt;Likes&gt; likesData = new ArrayList&lt;FBStatus.Likes&gt;(); public List&lt;Comment&gt; commentData = new ArrayList&lt;FBStatus.Comment&gt;(); </code></pre> <p>Some changes done in parsing class</p> <pre><code> private ArrayList&lt;FBStatus&gt; mData = new ArrayList&lt;FBStatus&gt;(); JsonParsing parsing = new JsonParsing(); jObj = parsing.getJSONFromUrl(FB_COMMENT + mAccessToken); try { data = jObj.getJSONArray(TAG_DATA); for (int i = 0; i &lt; data.length(); i++) { FBStatus bean = new FBStatus(); JSONObject c = data.getJSONObject(i); bean.setPostId(c.getString(TAG_ID)); JSONObject fromElement = new JSONObject(data.getJSONObject(i) .getString(TAG_FROM)); if (fromElement != null) { bean.setCategory(fromElement.getString(TAG_CATEGORY)); bean.setCatId(fromElement.getString(TAG_ID)); bean.setName(fromElement.getString(TAG_NAME)); } JSONObject shareElement = new JSONObject(data.getJSONObject(i) .getString(TAG_SHARE)); if (shareElement != null) { bean.setShareCount(shareElement.getString(TAG_SHARE_COUNT)); } JSONObject likesObj = new JSONObject(data.getJSONObject(i) .getString(TAG_LIKES)); JSONArray likesArray = likesObj.getJSONArray(TAG_DATA); for (int index = 0; index &lt; likesArray.length(); index++) { JSONObject likesElement = likesArray.getJSONObject(index); Likes like = bean.new Likes(); like.setId(likesElement.getString(TAG_ID)); like.setName(likesElement.getString(TAG_NAME)); bean.likesData.add(like); } JSONObject commentObj = new JSONObject(data.getJSONObject(i) .getString(TAG_COMMENT)); JSONArray commentArray = commentObj.getJSONArray(TAG_DATA); for (int index = 0; index &lt; commentArray.length(); index++) { JSONObject commentElement = commentArray .getJSONObject(index); Comment comment = bean.new Comment(); comment.setId(commentElement.getString(TAG_ID)); comment.setMessage(commentElement.getString(TAG_MESSAGE)); comment.setCreatedTime(commentElement .getString(TAG_CREATED_TIME)); comment.setLikecount(commentElement .getString(TAG_LIKE_COUNT)); JSONObject fromCommentElement = new JSONObject(commentArray .getJSONObject(index).getString(TAG_FROM)); if (fromCommentElement != null) { comment.setName(fromCommentElement.getString(TAG_NAME)); comment.setCommenterId(fromCommentElement .getString(TAG_ID)); } bean.commentData.add(comment); } bean.setStory(c.getString(TAG_STORY)); bean.setPicture(c.getString(TAG_PICTURE)); bean.setType(c.getString(TAG_TYPE)); bean.setStatus_type(c.getString(TAG_STATUS_TYPE)); bean.setObjectId(c.getString(TAG_OBJECT_ID)); bean.setCreatedTime(c.getString(TAG_CREATED_TIME)); bean.setUpdatedTime(c.getString(TAG_UPDATED_TIME)); mData.add(bean); } } catch (JSONException e) { e.printStackTrace(); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload