Sorting messages
Hey guys, I want to sort the messages by Timestamp I know that I can sort the collection before adding it to the adapter but my problem is when I want to add a single message to the adapter that's already populated with data
thanks in advance
If you know that the single message is the last message, you can add simply it to the messages adapter: messagesAdapter.addToStart(message, true);
For me personally, whenever I retrieve a message, each message is added to an ArrayList (messages), sorted (by sorting the collection), then clearing the adapter before adding the messages to the adapter as such: messagesAdapter.addToEnd(messages, true);
If you find a better way, do share it! Cheers