Expandable click for Android listeners ExpandableListView prevents extension

I use ExpandableListViewin my Android application to perform an action if the user takes a long time to click on a group item, so I defined OnLongClickListenerin my extension BaseExpandableListAdapter. The listener works as an aspect, but the child elements no longer expand. Any ideas?

 public class ConnectionAdapter extends BaseExpandableListAdapter {
    ...
    public View getGroupView(int groupPosition, boolean isExpanded, View convertView,  
                             ViewGroup parent) {
        // convertView is a LinearLayout
        convertView.setOnLongClickListener(new OnLongClickListener() {
            public boolean onLongClick(View v) {
                // my action here
                return true;
            }
        });
     }
     ...   
 }
+5
source share
2 answers

, - onClick, , "true" . , , . , , false true

+1

setOnItemLongClickListener . ExpandableListView.PACKED_POSITION_TYPE_GROUP - , ExpandableListView.PACKED_POSITION_TYPE_CHILD, longclicks .

- :

    pager_income = (ExpandableListView) findViewById(R.id.income_scroll);

    pager_income.setOnItemLongClickListener(new OnItemLongClickListener() {
        @Override
        public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
            if (ExpandableListView.getPackedPositionType(id) == ExpandableListView.PACKED_POSITION_TYPE_GROUP) {
                // Your code with group long click 

                return true;
            }

            return false;
        }
    });
+4

All Articles