My application allows users to chat with friends (like skype or whatsapp), so I have an Activity for displaying a “conversation” (a list).
The user can change from one conversation to another.
So, the problem is changing from one list to another, or “updating” the whole list of messages.
What is the best way to do that? (performance and memory)
– Remove all elements from the list and add the new messages?
– Use multiple ListViews and Adapters?
…
Thanks!
I’d say it all depends on how you’re storing the messages, and a lot of other parameters revolving around that.
However, I would probably cache the messages locally so that when the user selects a new conversation, they first get the to see the old messages while loading the new ones. One ListView, one ListAdapter of some sort and a List that I clear out when switching between conversations.
That might not be the most optimal approach, but that’s how I’d do it in the given scenario.