user1507832
user1507832

Reputation: 51

Expandable listview child default selection always position 0, when group expand

I have develop ExpandableListView perfectly.When user click the group row, the children list is expanded and show perfectly ,My question is how to show child index 0 always checked when group expand,Please help me ..

parent.setItemChecked(index, true);

working fine when click child, but cant set default selection position as 0 for every child group

Upvotes: 0

Views: 1281

Answers (2)

IntelliJ Amiya
IntelliJ Amiya

Reputation: 75788

After using OnGroupExpandListener , You can check which group is expand

 YOUR_EXP_LISTVIEW.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() {

                @Override
                public boolean onGroupClick(ExpandableListView parent, View v,
                                            int groupPosition, long id) {

                    if(parent.isGroupExpanded(groupPosition))
                    {

                     // Do your Staff
                    }
                    else{

                       // Expanded ,Do your Staff

                    }


                    return false;
                }
            });

Or try this way..

    setOnGroupExpandListener(new OnGroupExpandListener() {

    @Override
     public void onGroupExpand(int arg0) {

     // Your staff
      }
       });

Upvotes: 1

justHooman
justHooman

Reputation: 3054

Have you try listening to OnGroupExpandListener then use setSelectedChild?

Upvotes: 0

Related Questions