Search code examples
androidlistviewhashmapsimpleadapterread-unread

List View Read and Unread messages


I have a list view in which i show the list of messages. I am using SimpleAdapter to show the listview. I have a flag(true/false) set in the hash map(that shows whether message is read or not).Its working properly. I could update flag once it is read. How to differentiate read and unread messages(I just want bold text view for unread message).


Solution

  • Use a DerivedBaseAdapter. In the getView() method check the true/false for the key value. Correspondingly make the text in the listView bold.