# How can I get all members of a GroupChannel

**URL:** <https://community.sendbird.com/t/how-can-i-get-all-members-of-a-groupchannel/1238>\
**Category:** Android\
**Tags:** group-channel\
**Created:** [November 4, 2020, 1:04pm UTC](https://community.sendbird.com/t/how-can-i-get-all-members-of-a-groupchannel/1238 "2020-11-04T13:04:22Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![antonio.vitiello](https://avatars.discourse-cdn.com/v4/letter/a/e47774/32.png) [@antonio.vitiello](https://community.sendbird.com/u/antonio.vitiello)\
**Post date:** [November 4, 2020, 1:04pm UTC](https://community.sendbird.com/t/how-can-i-get-all-members-of-a-groupchannel/1238/1 "2020-11-04T13:04:22Z")

</div>

How can I get 500 members of a GroupChannel sorted by OPERATOR firts and then also in alphabetical order?

---

<div class="post-metadata">

**Author:** ![antonio.vitiello](https://avatars.discourse-cdn.com/v4/letter/a/e47774/32.png) [@antonio.vitiello](https://community.sendbird.com/u/antonio.vitiello)\
**Post date:** [November 4, 2020, 4:28pm UTC](https://community.sendbird.com/t/how-can-i-get-all-members-of-a-groupchannel/1238/2 "2020-11-04T16:28:35Z")

</div>

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)
            }
        }
    }
}
```

---

<div class="post-metadata">

**Author:** ![Alex\_Preston](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/alex_preston/32/167_2.png) [@Alex\_Preston](https://community.sendbird.com/u/Alex_Preston)\
**Post date:** [November 4, 2020, 4:33pm UTC](https://community.sendbird.com/t/how-can-i-get-all-members-of-a-groupchannel/1238/3 "2020-11-04T16:33:20Z")

</div>

@antonio.vitiello,

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](https://github.com/sendbird/SendBird-Android/blob/master/basic/app/src/main/java/com/sendbird/android/sample/groupchannel/MemberListActivity.java). It does not show the specific query you have but the Activity does show adding to the adapter.

---

<div class="post-metadata">

**Author:** ![antonio.vitiello](https://avatars.discourse-cdn.com/v4/letter/a/e47774/32.png) [@antonio.vitiello](https://community.sendbird.com/u/antonio.vitiello)\
**Post date:** [November 4, 2020, 4:48pm UTC](https://community.sendbird.com/t/how-can-i-get-all-members-of-a-groupchannel/1238/4 "2020-11-04T16:48:52Z")

</div>

> [@Alex\_Preston](#):
>
> Are you just trying to display the members of the channel?

Hi @Alex_Preston, do you mean like so?

```
private fun showMembers(channel: GroupChannel) {     
    adapter.switchData (channel.members)
 }

```

---

<div class="post-metadata">

**Author:** ![antonio.vitiello](https://avatars.discourse-cdn.com/v4/letter/a/e47774/32.png) [@antonio.vitiello](https://community.sendbird.com/u/antonio.vitiello)\
**Post date:** [November 4, 2020, 4:57pm UTC](https://community.sendbird.com/t/how-can-i-get-all-members-of-a-groupchannel/1238/5 "2020-11-04T16:57:54Z")

</div>

@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.

---

<div class="post-metadata">

**Author:** ![Alex\_Preston](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/alex_preston/32/167_2.png) [@Alex\_Preston](https://community.sendbird.com/u/Alex_Preston)\
**Post date:** [November 4, 2020, 5:20pm UTC](https://community.sendbird.com/t/how-can-i-get-all-members-of-a-groupchannel/1238/6 "2020-11-04T17:20:47Z")

</div>

@antonio.vitiello,

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.

---

<div class="post-metadata">

**Author:** ![antonio.vitiello](https://avatars.discourse-cdn.com/v4/letter/a/e47774/32.png) [@antonio.vitiello](https://community.sendbird.com/u/antonio.vitiello)\
**Post date:** [November 4, 2020, 6:10pm UTC](https://community.sendbird.com/t/how-can-i-get-all-members-of-a-groupchannel/1238/7 "2020-11-04T18:10:30Z")

</div>

> [@Alex\_Preston](#):
>
> 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.

---

<div class="post-metadata">

**Author:** ![Alex\_Preston](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/alex_preston/32/167_2.png) [@Alex\_Preston](https://community.sendbird.com/u/Alex_Preston)\
**Post date:** [November 4, 2020, 6:16pm UTC](https://community.sendbird.com/t/how-can-i-get-all-members-of-a-groupchannel/1238/8 "2020-11-04T18:16:40Z")

</div>

> [@antonio.vitiello](#):
>
> Now I have to figure out how to integrate with a RecyclerView when it scrolls down or up the bounds…

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.

---

<div class="post-metadata">

**Author:** ![antonio.vitiello](https://avatars.discourse-cdn.com/v4/letter/a/e47774/32.png) [@antonio.vitiello](https://community.sendbird.com/u/antonio.vitiello)\
**Post date:** [November 4, 2020, 6:27pm UTC](https://community.sendbird.com/t/how-can-i-get-all-members-of-a-groupchannel/1238/9 "2020-11-04T18:27:52Z")

</div>

Ok thanks a lot @Alex_Preston
