Mnemone
Mnemone

Reputation: 121

Use onChildClickListener with ExpendableListView

How do you use onClickListener with Expendable List view in such a way that clicking a child item creates a new Activity?

I already did what this guy made but don't have ANY idea how to make the child item create a new Activity. He explained the bit in the comments but don't know what to go after

 ExpandListChild ch =  ExpListItems.get(groupPosition).getItems().get(childPosition);

I also included

ExpandList.setOnChildClickListener(ExpandList_ItemClicked);

on the onCreate method. I know I have to do something about the 'ch' variable, but don't know what its values corresponding to the clicked item are. Can somebody please help?

Upvotes: 0

Views: 182

Answers (2)

Sudheesh B Nair
Sudheesh B Nair

Reputation: 11083

 ExpandList.setOnChildClickListener(new OnChildClickListener() {

        @Override
        public boolean onChildClick(ExpandableListView arg0, View arg1, int arg2, int arg3, long arg4) {
            // TODO Auto-generated method stub
            return false;
        }
    });

Try this.

Upvotes: 0

Hoan Nguyen
Hoan Nguyen

Reputation: 18151

onChildClick (ExpandableListView parent, View v, int groupPosition, int childPosition, long id)

When your ChildClick listener is called you get all the information you need, so ch is not needed.

Upvotes: 1

Related Questions