How can I get 500 members of a GroupChannel sorted by OPERATOR firts and then also in alphabetical order?
I think I found a solution, I publish it here in favor of someone else with the same need.
Now I have to figure out how to integrate with a RecyclerView when it scrolls down or up the bounds…
private fun fetchMembers(channel: GroupChannel) {
myProgress.show()
memberListQuery = channel.createMemberListQuery().apply {
setLimit(100)
setOrder(GroupChannelMemberListQuery.Order.OPERATOR_THEN_MEMBER_ALPHABETICAL)
next { members, exc ->
myProgress.hide()
recyclerView.visibility = View.VISIBLE
if (exc != null) {
adapter.switchData(channel.members)
Timber.e(exc, "Sendbird: error while fetching channel members.")
} else {
adapter.switchData(members)
}
}
}
}
Are you just trying to display the members of the channel? I think our sample app has similar implementations. If you check out this class. It does not show the specific query you have but the Activity does show adding to the adapter.
Hi @Alex_Preston, do you mean like so?
private fun showMembers(channel: GroupChannel) {
adapter.switchData (channel.members)
}
@Alex_Preston unfortunately by this way channel.members
only the first 10 members of the channel are returned, if I’m not mistaken, but I have about 500 members in this group channel.
Apologies I might have confused you, I would recommend the approach you did above creating a query. I was referencing your second part about where you were trying to figure out how to integrate it with a RecyclerView.
@Alex_Preston can you elaborate please? I think I did not understand.
I was referencing this statement. I thought you were good on your original ask, you just needed to figure out how to implement it with recyclerview.
Ok thanks a lot @Alex_Preston