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

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. ja v  a 2  s.  c o  m
import android.content.Intent;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;

import java.util.ArrayList;
import java.util.HashMap;

import io.rong.imkit.view.ActionBar;
import io.rong.imlib.RongIMClient;

 * Created by zhjchen on 14-4-16.

public class GroupListActivity extends BaseActivity implements AdapterView.OnItemClickListener {

    private ListView mListView;
    private GroupListAdapter mGroupListAdapter;
    private ActionBar mActionBar;

    protected int setContentViewResId() {
        return R.layout.activity_group_list;

    protected void initView() {
        mListView = getViewById(;
        mActionBar = getViewById(;

    protected void initData() {

        HashMap<String, RongIMClient.Group> groupMap = DemoContext.getInstance().getGroupMap();

        ArrayList<RongIMClient.Group> groups=new ArrayList<RongIMClient.Group>();

        for (String groupId : groupMap.keySet()) {

        mActionBar.setOnBackClick(new View.OnClickListener() {
            public void onClick(View v) {
        mGroupListAdapter = new GroupListAdapter(this, groups);

    public void onItemClick(AdapterView<?> parent, View view, int position,
                            long id) {

        RongIMClient.Group group=mGroupListAdapter.getItem(position);

        Uri uri = Uri.parse("rong://" + this.getPackageName()).buildUpon()
                .appendQueryParameter("targetId", group.getId()).appendQueryParameter("title", group.getName()).build();

        startActivity(new Intent(Intent.ACTION_VIEW, uri));


Java Source Code List