RVCommentAdapter¶
-
public class
RVCommentAdapterextends RecyclerView.Adapter<RVCommentAdapter.PostReplyViewHolder>¶ Adapter that populates a UI list with comments
Constructors¶
RVCommentAdapter¶
-
public
RVCommentAdapter(List<PostReply> comments, OnItemClickListener listener, Context context)¶ Store parameters in instance fields
Parameters: - comments – List of comments to display in scrollable list to user
- listener – Will be called whenever an item is clicked
- context –
Contextwithin which the list will be displayed
Methods¶
getItemCount¶
-
public int
getItemCount()¶ Get the number of comments in the list
Returns: Number of comments in list
onBindViewHolder¶
-
public void
onBindViewHolder(PostReplyViewHolder pvh, int i)¶ Fill in the fields of
pvhwith the information stored in thePostReplyat positioniin the list of commentsParameters:
onCreateViewHolder¶
-
public PostReplyViewHolder
onCreateViewHolder(ViewGroup parent, int viewType)¶ Create a
PostReplyViewHolderforparentwith aViewinflated fromR.layout.comment_viewParameters: - parent –
ViewGroupwithin which to create thePostReplyViewHolder - viewType – Not used
Returns: The
PostReplyViewHolderassociated with the inflatedView- parent –