title: Item not showing inside RecyclerView
body: <p>I check everything in my code,I ask a question and do some of the modification,and also reading all the question about "Item not showing in RecyclerView",but the layout still not appear in my recyclerView.</p>
  
  <p><a href="https://stackoverflow.com/questions/42929053/recycleview-not-showing-in-dialogue-fragment">This is my previous question</a>,I attach all my code here,have 3 answer tell me,I should use <code>LinearLayout</code> instead of <code>RelativeLayout</code> as the parent of <code>RecyclerView</code>,so I modified the code as below </p>
  
  <p><strong>Fragment.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/commentFragment"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:paddingBottom="@dimen/activity_vertical_margin"
  android:paddingLeft="@dimen/activity_horizontal_margin"
  android:paddingRight="@dimen/activity_horizontal_margin"
  android:paddingTop="@dimen/activity_vertical_margin"&gt;
  
  
  &lt;LinearLayout
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical"&gt;
  
      &lt;LinearLayout
          android:id="@+id/titlebar"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:orientation="horizontal"&gt;
  
          &lt;TextView
              android:id="@+id/textView"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:layout_marginLeft="@dimen/feed_item_margin"
              android:layout_marginRight="@dimen/feed_item_margin"
              android:layout_marginTop="@dimen/feed_item_margin"
              android:layout_weight="1"
              android:text="Be the first to like this" /&gt;
  
      &lt;/LinearLayout&gt;
  
      &lt;android.support.v7.widget.RecyclerView
          android:id="@+id/comment_recycler_view"
          android:layout_width="match_parent"
          android:layout_height="0dp"
          android:layout_weight="1"
          android:animateLayoutChanges="false"
          android:scrollbars="vertical"&gt;
  
      &lt;/android.support.v7.widget.RecyclerView&gt;
  
      &lt;LinearLayout
          android:id="@+id/commentInsert"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:background="@android:color/white"
          android:orientation="horizontal"&gt;
  
          &lt;EditText
              android:id="@+id/commentField"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_weight="1"
              android:background="@null"
              android:ems="10"
              android:hint="Add a comment" /&gt;
  
          &lt;Button
              android:id="@+id/sendButton"
              android:layout_width="77dp"
              android:layout_height="wrap_content"
              android:text="Send" /&gt;
  
      &lt;/LinearLayout&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p></p>
  
  <p>Here is the item which should be appear in the RecyclerView.<code>comment_item.xml</code></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
  android:layout_weight="1"&gt;
  
  &lt;ImageView
      android:id="@+id/commentProfilePic"
      android:layout_weight="0.05"
      android:layout_width="@dimen/comment_item_profile_pic"
      android:layout_height="@dimen/comment_item_profile_pic"
      android:layout_marginLeft="@dimen/feed_item_margin"
      android:layout_marginRight="@dimen/feed_item_margin"
      android:layout_marginTop="@dimen/feed_item_margin"
      android:scaleType="fitCenter" /&gt;
  
  &lt;LinearLayout
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_marginLeft="@dimen/feed_item_margin"
      android:layout_marginRight="@dimen/feed_item_margin"
      android:layout_marginTop="@dimen/feed_item_margin"
      android:orientation="vertical"
      android:layout_weight="1"
      android:paddingLeft="@dimen/comment_item_profile_info_padd"&gt;
  
      &lt;TextView
          android:id="@+id/commentUsername"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:paddingLeft="@dimen/comment_item_status_pad_left_right"
          android:paddingRight="@dimen/comment_item_status_pad_left_right"
          android:textStyle="bold" /&gt;
  
      &lt;TextView
          android:id="@+id/commentBody"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:paddingLeft="@dimen/comment_item_status_pad_left_right"
          android:paddingRight="@dimen/comment_item_status_pad_left_right" /&gt;
  
      &lt;TextView
          android:id="@+id/commentTimestamp"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:paddingLeft="@dimen/comment_item_status_pad_left_right"
          android:paddingRight="@dimen/comment_item_status_pad_left_right"
          android:paddingTop="@dimen/comment_item_timestamp_pad_top" /&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p></p>
  
  <p>I read this <a href="https://stackoverflow.com/questions/29558295/recyclerview-not-showing-anything">issue</a> tell that need to add this line of code <code>adapter.notifyDataSetChanged();</code>,I done that,this is how I <code>notifyDataSetChanged()</code> when I parse the JSON.</p>
  
  <pre><code> private void parseJsonFeed(JSONObject response) {
      try {
  
          JSONArray commentArray = response.getJSONArray("comment");
          //get all the item in Json
          for (int i = 0; i &lt; commentArray.length(); i++) {
              JSONObject commentObj = (JSONObject) commentArray.get(i);
  
              commentId = commentObj.getInt("comment_id");
              commenterUsername= commentObj.getString("commenter_username");
              commentBody =  commentObj.getString("comment_body");
              commenterProfileImage =  commentObj.getString("commenter_profile_image");
              commentCreatedAt = commentObj.getString("comment_created_at");
  
              //set all item to the Array list
              setItemToCommentArrayList(commentId,commenterUsername,commenterProfileImage,commentBody,commentCreatedAt);
  
          }
  
          // notify data changes to list adapter
          commentAdapter.notifyDataSetChanged();
  
      }catch (JSONException e){
          System.out.println("end of content");
      }
  
  }
  </code></pre>
  
  <p>I checked,whether is something wrong when I set my adapter to the RecycleView.So i read this <a href="https://stackoverflow.com/a/15464294/4332049">answer</a>,and here is how I set my adapter</p>
  
  <pre><code>@Override
  public View onCreateView(LayoutInflater inflater,  ViewGroup container, Bundle savedInstanceState) {
  
      View dialogView = inflater.inflate(R.layout.fragment_comment, container,false);
      commentRecyclerView =(RecyclerView)dialogView.findViewById(R.id.comment_recycler_view);
      commentRecyclerView.setNestedScrollingEnabled(false);
  
      //bind the recycler view with the adapter
      commentAdapter = new CommentAdapter(getActivity(),commentItems);
      final LinearLayoutManager myLayoutManager = new LinearLayoutManager(getActivity());
      commentRecyclerView.setLayoutManager(myLayoutManager);
      commentRecyclerView.setAdapter(commentAdapter);
  </code></pre>
  
  <p><strong>Here is my <code>CommentAdpater</code></strong> , I still didnt see any different with my another recycleview adapter. </p>
  
  <pre><code>public class CommentAdapter extends RecyclerView.Adapter&lt;CommentAdapter.MyViewHolder&gt;{
      private Context cContext;
      private List&lt;CommentItem&gt; commentItems;
  
      class MyViewHolder extends RecyclerView.ViewHolder{
          TextView commentBody,commentUsername,commentTimeStamp;
          ImageView commentProfilePic;
  
          //find all the view here
          MyViewHolder(final View view) {
             super(view);
  
              commentProfilePic = (ImageView)view.findViewById(R.id.commentProfilePic);
              commentUsername = (TextView)view.findViewById(R.id.commentUsername);
              commentBody = (TextView)view.findViewById(R.id.commentBody);
              commentTimeStamp = (TextView)view.findViewById(R.id.commentTimestamp);
  
          }
      }
  
      public CommentAdapter(Context cContext, List&lt;CommentItem&gt; commentItems)       {
          this.cContext = cContext;
          this.commentItems = commentItems;
      }
  
  
      @Override
      public long getItemId(int position) {
          return position;
      }
      //this one for make the adview inside this
      @Override
      public int getItemViewType(int position) {
          return position;
      }
  
  
      //bind the comment item here
      @Override
      public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
          View commentItemView = LayoutInflater.from(parent.getContext())
                  .inflate(R.layout.comment_item, parent, false);
          return new MyViewHolder(commentItemView);
      }
  
      //do all the action here
      @Override
      public void onBindViewHolder(CommentAdapter.MyViewHolder holder, int position) {
  
          final CommentItem commentItem = commentItems.get(position);
  
          //commenter username
          holder.commentUsername.setText(commentItem.getUsername());
  
          //commenter profile image
          Glide
                  .with(cContext)
                  .load(commentItem.getCommentProfilePic())
                  .fitCenter()
                  .into(holder.commentProfilePic);
  
  
          //comment body
          holder.commentBody.setText(commentItem.getCommentBody());
  
          //comment timestamp
          holder.commentTimeStamp.setText(commentItem.getCommentTimeStamp());
      }
  
      @Override
      public int getItemCount() {
          return commentItems.size();
      }
  }
  </code></pre>
  
  <p>I make sure my JSON is received in my volley Request.I log it out,is received in Volley <code>onResponse</code> .My JSON is look like this </p>
  
  <pre><code>  "comment":[{"comment_created_at":"2017-03-21 13:03:40","comment_id":8,"comment_body":"abc","commenter_username":"abc","profile_image_path":"http:\/\/abc\/def\/v1\/ef\/defaultmale.jpg"
  </code></pre>
  
  <p>And this <a href="https://stackoverflow.com/questions/42926140/json-adding-backslash-in-volley-response-called-in-a-dialogue-fragment?noredirect=1#comment72951414_42926140">question</a> I ask just tell me no need to worry about cause I using <code>Glide</code> to load my image,<code>Glide</code> will handle that</p>
  
  <p>This is all the solution that tried,and still havent get it done,so what I still missing out here,in order the <code>comment_xml</code>appear to the <code>recyclerView</code> inside <code>Fragment.xml</code>? Any guide that lead me to the right direction is well-appreciated.Thanks</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p><strong>Here is my <code>setItemToCommentArrayList()</code></strong></p>
  
  <pre><code>private void setItemToCommentArrayList(int commentId, String commenterUsername, String commenterProfileImage, String commentBody, String commentCreatedAt) {
      CommentItem item = new CommentItem();
      item.setCommentId(commentId);
      item.setUsername(commenterUsername);
      item.setCommentProfilePic(commenterProfileImage);
      item.setCommentBody(commentBody);
      item.setCommentTimeStamp(commentCreatedAt);
  
  
      //save it to the comment array list
      commentItems.add(item);
  }
  </code></pre>
  
  <p><strong>Here is my data model of Comment Item</strong> </p>
  
  <pre><code>public class CommentItem {
  private String username,commentBody,commentTimeStamp,commentProfilePic;
  private int commentId;
  
  public CommentItem(){
  }
  
  public CommentItem(int commentId, String username,String commentBody,String commentTimeStamp,String commentProfilePic){
      super();
      this.commentId = commentId;
      this.username = username;
      this.commentBody = commentBody;
      this.commentProfilePic= commentTimeStamp;
      this.commentTimeStamp= commentProfilePic;
  }
  
  public int getCommentId() {
      return commentId;
  }
  
  public void setCommentId(int commentId) {
      this.commentId = commentId;
  }
  
  
  public String getUsername() {
      return username;
  }
  
  public void setUsername(String username) {
      this.username = username;
  }
  
  public String getCommentBody() {
      return commentBody;
  }
  
  public void setCommentBody(String commentBody) {
      this.commentBody = commentBody;
  }
  
  public String getCommentTimeStamp() {
      return commentTimeStamp;
  }
  
  public void setCommentTimeStamp(String commentTimeStamp) {
      this.commentTimeStamp = commentTimeStamp;
  }
  
  public String getCommentProfilePic() {
      return commentProfilePic;
  }
  
  public void setCommentProfilePic(String commentProfilePic) {
      this.commentProfilePic = commentProfilePic;
  }
  }
  </code></pre>