Found such a solution, code in the Activity :
ExpandableListViewSynchronisationTouchListener expandableListViewSynchronisationTouchListener = new ExpandableListViewSynchronisationTouchListener(this, firstExpandable, secondExpandable); firstExpandable.setOnTouchListener(expandableListViewSynchronisationTouchListener); secondExpandable.setOnTouchListener(expandableListViewSynchronisationTouchListener); firstExpandable.setOnChildClickListener(expandableListViewSynchronisationTouchListener); secondExpandable.setOnChildClickListener(expandableListViewSynchronisationTouchListener);
The class responsible for synchronizing the two ExpandableListView :
public class ExpandableListViewSynchronisationTouchListener implements View.OnTouchListener, ExpandableListView.OnChildClickListener, ExpandableListView.OnGroupClickListener, ExpandableListView.OnGroupExpandListener { private static final String TAG = ExpandableListViewSynchronisationTouchListener.class.getSimpleName(); private Context context; private View clickSource; private View touchSource; private View firstExpandable; private View secondExpandable; public ExpandableListViewSynchronisationTouchListener(Context context, View fistExpandable, View secondExpandable) { this.context = context; this.firstExpandable = fistExpandable; this.secondExpandable = secondExpandable; } @Override public boolean onTouch(View view, MotionEvent motionEvent) { if (touchSource == null) { touchSource = view; } if (view == touchSource) { if (view != firstExpandable) { firstExpandable.dispatchTouchEvent(motionEvent); } else if (view != secondExpandable) { secondExpandable.dispatchTouchEvent(motionEvent); } if (motionEvent.getAction() == MotionEvent.ACTION_UP) { clickSource = view; touchSource = null; } } return false; } @Override public boolean onGroupClick(ExpandableListView parent, View view, int groupPosition, long id) { if (parent == clickSource) { if (parent == firstExpandable) { Toast.makeText(context, "First expandable id: " + view.getId() + " group position: " + groupPosition, Toast.LENGTH_SHORT).show(); } else if (parent == secondExpandable) { Toast.makeText(context, "Second expandable id: " + view.getId() + " group position: " + groupPosition, Toast.LENGTH_SHORT).show(); } } return false; } @Override public boolean onChildClick(ExpandableListView parent, View view, int groupPosition, int childPosition, long id) { if (parent == clickSource) { if (parent == firstExpandable) { Toast.makeText(context, "First expandable id: " + view.getId() + " group position: " + groupPosition + " child position: " + childPosition, Toast.LENGTH_SHORT).show(); } else if (parent == secondExpandable) { Toast.makeText(context, "Second expandable id: " + view.getId() + " group position: " + groupPosition + " child position: " + childPosition, Toast.LENGTH_SHORT).show(); } } return false; } @Override public void onGroupExpand(int groupPosition) { Log.d(TAG, "Group expand: " + groupPosition); } }
onScrollListenerin both lists, and assigning adxvalue from one list to another? - Silento