Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>According to the api refference description of <a href="http://developer.android.com/reference/android/widget/ExpandableListView.OnChildClickListener.html#onChildClick%28android.widget.ExpandableListView,%20android.view.View,%20int,%20int,%20long%29" rel="nofollow">onChildClick</a>, you already have the position of parent group.</p> <blockquote> <p>public abstract boolean onChildClick (ExpandableListView parent, View v, int groupPosition, int childPosition, long id) Added in API level 1</p> <p>Callback method to be invoked when a child in this expandable list has been clicked.</p> <p>Parameters</p> <ul> <li>parent - The ExpandableListView where the click happened</li> <li>v -The view within the expandable list/ListView that was clicked</li> <li>groupPosition - The group position that contains the child that was clicked</li> <li>childPosition - The child position within the group</li> <li>id - The row id of the child that was clicked</li> </ul> </blockquote> <p>Returns True if the click was handled</p> <p><strong>EDITED:</strong> There is two positions in the onChildClick that you need - <em>parent</em> and <em>child</em>. Parent defines the position of group, child defines the position within the group. adapter.getChild(groupPos, childPos) returns an object related to the specified child item.</p> <pre><code> catlist.setOnChildClickListener(new OnChildClickListener() { @Override public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) { System.out.println("childPosition: " + childPosition); System.out.println("groupPosition: " + groupPosition); // only if you need related data Object itemData = expListAdapter.getChild(groupPosition, childPosition); } }); </code></pre> <p>If you need to get this <code>itemData</code> value, you should implement <a href="http://developer.android.com/reference/android/widget/ExpandableListAdapter.html#getChild%28int,%20int%29" rel="nofollow">getChild()</a> method in your adapter.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload