stepic
stepic

Reputation: 693

Android ExpandableListView get group number inside bindChildView

I'm using ExpandableListView with a SimpleCursorTreeAdapter. Is it possible to get the group number to which the current child belongs to inside the bindChildView method?

Thanks!

Upvotes: 2

Views: 1448

Answers (1)

stepic
stepic

Reputation: 693

I tried another approach to obtain group and child position using getChildView:

    @Override
    public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) {
        ImageButton ib=null;

        View v = super.getChildView(groupPosition, childPosition,isLastChild, convertView, parent);
        ib=(ImageButton)v.findViewById(R.id.delete);

        ib.setTag(R.id.TAG_GROUPPOS, groupPosition);
        ib.setTag(R.id.TAG_CHILDPOS, childPosition);

        return v;
    }

Upvotes: 3

Related Questions