Android Open Source - demo-app-android Group List Adapter

From Project

Back to project page demo-app-android.


The source code is released under:

MIT License

If you think the Android project demo-app-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package io.rong.imkit.demo;
/*from  w  w  w . j  ava  2 s .co m*/
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import java.util.ArrayList;

import io.rong.imlib.RongIMClient;

public class GroupListAdapter extends BaseAdapter {

    private ArrayList<RongIMClient.Group> groups;
    private LayoutInflater mLayoutInflater;
    private Context mContext;

    public GroupListAdapter(Context context, ArrayList<RongIMClient.Group> groups) {

        this.groups = groups;
        mLayoutInflater = LayoutInflater.from(context);
        mContext = context;

    public int getCount() {
        return groups.size();

    public RongIMClient.Group getItem(int position) {
        return groups.get(position);

    public long getItemId(int position) {
        return 0;

    public View getView(int position, View convertView, ViewGroup parent) {

        ViewHolder viewHolder;

        if (convertView == null || convertView.getTag() == null) {

            convertView = mLayoutInflater.inflate(R.layout.rc_item_group_list, null);
            viewHolder = new ViewHolder();
            viewHolder.titleTextView = (TextView) convertView.findViewById(;

        } else {
            viewHolder = (ViewHolder) convertView.getTag();

        RongIMClient.Group group = getItem(position);


        return convertView;

    static class ViewHolder {
        TextView titleTextView;

Java Source Code List