RVCommentAdapter¶
-
public class
RVCommentAdapter
extends 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 –
Context
within 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
pvh
with the information stored in thePostReply
at positioni
in the list of commentsParameters:
onCreateViewHolder¶
-
public PostReplyViewHolder
onCreateViewHolder
(ViewGroup parent, int viewType)¶ Create a
PostReplyViewHolder
forparent
with aView
inflated fromR.layout.comment_view
Parameters: - parent –
ViewGroup
within which to create thePostReplyViewHolder
- viewType – Not used
Returns: The
PostReplyViewHolder
associated with the inflatedView
- parent –