Open troy21688 opened 8 years ago
"RecyclerView references the parent view and not the individual CardView." Ans: Because in viewHolder, each view is not referenced to view v with findViewById.
public ViewHolder(View v) {
super(v);
userAvatar = (ImageView)v.findViewById(R.id.profile_image);
userID = (TextView)v.findViewById(R.id.user_ID);
userComment = (TextView)v.findViewById(R.id.user_comment_textview);
}
I am using a RecylerView to populate CardView items. I am noticing that the RecyclerView is generating a NullPointer here, as for some reason the RecyclerView references the parent view and not the individual CardView.
I believe the error is occurring here:
Here is my individual CardView XML (individual_comment.xml):
</android.support.v7.widget.CardView>
I am receiving a NullPointer for this line:
onCreateViewHolder: