Code example for ExpandableListView

Methods: collapseGroupexpandGroupgetExpandableListAdapterisGroupExpanded

0
     
    // Callbacks ---------------------------------------------------------------------------------- 
     
    public boolean onGroupClick(ExpandableListView list, View v, int groupPos, long id)
    { 
        CategoriesListAdapter      adapter = (CategoriesListAdapter)list.getExpandableListAdapter();
        CategoriesListAdapter.Item item    = (CategoriesListAdapter.Item)adapter.getGroup(groupPos);
         
        if (isFilterMode() && (item.id == null || list.isGroupExpanded(groupPos)))
        { 
            ((OnCategoriesListListener)getSherlockActivity()).categorySelected(item.id, false);
        } 
        else 
        { 
            if (!list.isGroupExpanded(groupPos))
            { 
                if (adapter.expandedGroup != -1)
                { 
                    list.collapseGroup(adapter.expandedGroup);
                } 
             
                list.expandGroup(groupPos);
 
                ((OnCategoriesListListener)getSherlockActivity()).categorySelected(item.id, true);
            } 
        }