I\'m working on a android chatting application. When I called my api it returns me the chat list sorted by a user_id. But what I need to do is serialized by
in Kotlin use like this after loading data in array:
myItems.sortWith(Comparator { lhs, rhs -> // -1 - less than, 1 - greater than, 0 - equal, all inversed for descending if (lhs.name > rhs.name) -1 else if (lhs.id < rhs.id) 1 else 0 })
After that apply:
myItemAdapter.notifyDataSetChanged()