How channels are getting listed

Hi, In the android app when I click on the Group channels, I would like to know which method returns this list of channels in custom-uikit-sample code.

Not sure if this is what you refer to but for Android and the uikit-custom-sample project, the listing of channels is located in:

com.sendbird.uikit.customsample.fragments.CustomChannelListFragment.java

Internally, onDrawPage() is performed so, if you override that method and remove the call to super, you won’t see the list at all.

Actually what I am looking is that…while we list the list of channel I would check the ‘channel member’ metadata to identify my key…so I will get only the workspace related to user channels…hope you got my point…I am looking for a place where I should able to check my channel values and show only required channels all-time while listing the channel

I really need your help to sort out this problem. Please don’t ignore…we were trying to solve this past 3 days and we failed to do it… please help us to understand.

Actually what I am looking is that…while we list the list of channel I would check the ‘channel member’ metadata to identify my key…so I will get only the workspace related to user channels…hope you got my point…I am looking for a place where I should able to check my channel values and show only required channels all-time while listing the channel

Hi, @sakkk
You can controll channel list in CustomChannelListAdapter. ChannelListFragment set channel list to CustomChannelListAdapter internally.

If you want to discriminate channel from channel list,

  1. you create your own ViewHolder
  2. Override getItemViewType and impl this method.
  3. Create different ViewHolder depending on viewType in onCreateViewHolder.

public class CustomChannelListAdapter extends ChannelListAdapter {

@NonNull
@Override
public BaseViewHolder<GroupChannel> onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
    // using viewType to discriminate channel
    return new CustomChannelViewHolder(ViewCustomChannelHolderBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false));
}

@Override
public void onBindViewHolder(@NonNull BaseViewHolder<GroupChannel> holder, int position) {
    super.onBindViewHolder(holder, position);
}

@Override
public int getItemViewType(int position) {
    GroupChannel channel = getItem(position);
    // Discriminate channel and return viewType you intend
    return viewType;
}

}

Hi.
I really don’t understand the logic here, can u please help me to write a quick code for my requirement. and which class.
My requirement is below…
if the channel message count is greater than 2, then only I wanted to display the channels,.Please help me…this is not the exact requirement but just simplifying it…

today after 3 days of long struggle , i have identified where need to put the condition…its just a single line and we no need to do anything like above or which you have mentioned in my previous topic…u could have helped to save my 3 days…anyways thanks for your initial helps …

1 Like

@sakkk
I apologize for not being able to give you an exact solution to your requirements. I’m glad you’ve solved it!

@sakkk Can you please post your solution? That will help us to provide a more precise solution. Thanks!