RecyclerView Endless Scrolling from Top (Android Recyclerview Chat Screen)

Hello Everybody!
This tutorial is just going to cover App side implementation of Chat window with:

  • Different message layout for Current user And Other users.
  • Upward Endless Scrolling With Progress At the top of the Screen (Inside RecyclerView).
  • App User Can post Message.

This is how its looks.

RecyclerView Endless Scrolling from Top RecyclerView Endless Scrolling from Top

 

And this is how its looks in Action.

RecyclerView Endless Scrolling from Top

 

There are two main component of this application

  1. MainActivity
  2. AdapterChat

In this app i am using lambda expression.To use lambda expression in android please update your android studio and add compileOptions into Build.gradle (Inside App module)

You dont need Any other dependency other than RecyclerView For this tutorial add RecyclerView dependency into Build.gradle (Inside App module)

This is the code of our MainActivity.
MainActivity.java

sendMsg()
I am using this function to add message posted by user to current list at the bottom of the page.
You can scroll to current message posted by yourself using mList.scrollToPosition(mChatList.size()-1);

loadMore()
I am using this function to generate dummy data to insert into message thread when user try to scroll upward. I think the code is self-explanatory

This is how our Adapter looks.
AdapterChat.java

RecyclerView Endless Scrolling from Top (Android Recyclerview Chat Screen)

 

 

 

 

Full Source Code

Leave a Reply

Your email address will not be published. Required fields are marked *