如何从expandableListView的setOnChildCliclkListener中的当前开始新活动?

时间:2016-09-01 07:08:55

标签: expandablelistview

expListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
        @Override
        public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {

            String headername = (String) parent.getExpandableListAdapter().getGroup(groupPosition);
            String childname = (String) parent.getExpandableListAdapter().getChild(groupPosition,childPosition);

            Log.d("Parent name",headername);
            Log.d("Child name", childname);

            Intent intent = new Intent(ViewActivity.this,ShowActivity.class);
            intent.putExtra("Parent",headername);
            intent.putExtra("Child",childname);
            intent.putExtra("Path",myPath);
            startActivity(intent);
            return true;
        }
    });

1 个答案:

答案 0 :(得分:0)

只需使用ActivityName.this.startActivity(),即可调用所需的意图。