[Solved] Unable to declare variable


You need to do findViewById inside MessageViewHolder() Using itemView

Try this

public class MessageViewHolder extends RecyclerView.ViewHolder {

        public TextView chatText;
        public CircleImageView chatImage;


        public MessageViewHolder(View itemView) {
            super(itemView);

          chatText =itemView.findViewById(R.id.chatText);
          chatImage=itemView.findViewById(R.id.chatImage);
        }


    }

4

solved Unable to declare variable