chat-sdk / chat-sdk-android

Chat SDK Android - Open Source Mobile Messenger

Home Page:https://chatsdk.co

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

one to one Public chat message count showing wrong.

slpatidar opened this issue · comments

when get the "thread.getMessages().size()" its returning wrong count .

I want to set a limitation for the chat message sent, but mostly the time when I trying to fetch the current sent message count it's returning the wrong count. I have sent only 20 messages to another user, and it's showing 24. how to get the exact count of the message between the user.

I have tried with following methods
1.messageListAdapter.getItemCount()
2.messageListAdapter.getMessageItems().size()
3. thread.getMessages().size()

Please help

This is because that method lazy loads messages. Use this instead:

List<Message> messages = getMessagesWithOrder(DaoCore.ORDER_DESC, Integer.MAX_VALUE);