newnewbie
newnewbie

Reputation: 1003

ExpandableListView where is the LIstener?

I have a basic ExpandableListView, reprogrammed using a tutorial:

http://www.tutorialsbuzz.com/2014/07/android-simple-expandable-listview.html

Now what I do not understand:

When I click on a groupItem it expands, showing the children. WHERE Is the Listener that actually handles this? I cannot find out which method is responsible for this. Probably a very basic question

Upvotes: 0

Views: 79

Answers (4)

Pradeep Sodhi
Pradeep Sodhi

Reputation: 2145

exp_list.setOnGroupExpandListener(new OnGroupExpandListener() {

        @Override
        public void onGroupExpand(int groupPosition) {
            // TODO Auto-generated method stub

        }
    });

Upvotes: 1

mujeeb.omr
mujeeb.omr

Reputation: 499

I hope these are the listeners you are looking for

        expandableListView.setOnGroupExpandListener();
        expandableListView.setOnGroupCollapseListener();
        expandableListView.setOnGroupClickListener();
        expandableListView.setOnChildClickListener();

Upvotes: 1

Nadeem Iqbal
Nadeem Iqbal

Reputation: 2384

Have you seen these three Listeners in your code??? It is in the tutorial as well, I copied these from your tutorial.

      //// Child Click Listener
    ExpandList.setOnChildClickListener(new OnChildClickListener() {

        @Override
        public boolean onChildClick(ExpandableListView parent, View v,
                int groupPosition, int childPosition, long id) {
            return false;
        }
    });

      //// Group expand Listener
    ExpandList.setOnGroupExpandListener(new OnGroupExpandListener() {

        @Override
        public void onGroupExpand(int groupPosition) {

        }
    });

      //// Group Collapse Listener
    ExpandList.setOnGroupCollapseListener(new OnGroupCollapseListener() {

        @Override
        public void onGroupCollapse(int groupPosition) {
        }
    });

Upvotes: 1

yashhy
yashhy

Reputation: 3096

ExpandableListView has OnChildClickListener which handles the child view clicks.

Interface definition for a callback to be invoked when a child in this expandable list has been clicked.

Upvotes: 1

Related Questions