Check out example codes for "group recyclerview list by date in android studio". It will help you in understanding the concepts better.

Code Example 1

public class ChatLeftViewHolder extends RecyclerView.ViewHolder {
        private final String TAG = ChatRightViewHolder.class.getSimpleName();

        public ChatLeftViewHolder(View itemView) {
            //TODO initialize your xml views

        public void bind(final ChatModel chatModel) {
            //TODO set data to xml view via textivew.setText();

Code Example 2

public class DateObject extends ListObject {
        private String date;

        public String getDate() {
            return date;

        public void setDate(String date) {
   = date;

        public int getType(int userId) {
            return TYPE_DATE;

Code Example 3

public abstract class ListObject {
        public static final int TYPE_DATE = 0;
        public static final int TYPE_GENERAL_RIGHT = 1;
        public static final int TYPE_GENERAL_LEFT = 2;

        abstract public int getType(int userId);

Learn ReactJs, React Native from