This is a question w.r.t a chat app developed using applozic sdk. Currently in the chat detail page, the latest conversation is loaded. But I want to show the unread message that arrived first rather than the latest message arrived. How can it be achieved ?
Asked
Active
Viewed 376 times
3
-
Maybe what you can do is, when you are opening the chat details, you must be having something called, unread count which would indicate the number of messages that haven't been read yet. You can use this value to scroll your list to that particular message rather than scrolling to bottom. – Shivam Pokhriyal Sep 07 '18 at 20:29
2 Answers
2
What you can do is, when you are opening the chat details, you must be having something called, unread count which would indicate the number of messages that haven't been read yet, correct. So you can use this value to scroll your list to that particular message rather than scrolling to bottom.

Shivam Pokhriyal
- 1,044
- 11
- 26
1
You can use this in onChildAdded, by getting the unSeenMessageCount as an int
if (unSeenMessageCount == 0) {
rvChat.scrollToPosition(chatsAdapter.getItemCount() - 1);
} else {
rvChat.scrollToPosition(chatsAdapter.getItemCount() - unSeenMessageCount);
}

DragonFire
- 3,722
- 2
- 38
- 51