Getting item position in childView from expandable listview android

802 Views Asked by At

i have a multiple check boxes in a row of child view, how to get the position of each check box in a child row and i need to uncheck the one check box,if all the check boxes in a row are

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/child"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal" >

    <CheckBox
        android:id="@+id/child_check_box"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

    <ImageView
        android:id="@+id/ACimageView1"
        android:layout_width="80dp"
        android:layout_height="80dp"
        android:layout_below="@+id/child_check_box"
        android:src="@drawable/ic_launcher" />
   <CheckBox
        android:id="@+id/child_check_box33"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

    <ImageView
        android:id="@+id/ACimageView2"
        android:layout_width="80dp"
        android:layout_height="80dp"
        android:layout_below="@+id/child_check_box"
        android:src="@drawable/ic_launcher" />
     <CheckBox
        android:id="@+id/child_check_box3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

    <ImageView
        android:id="@+id/ACimageView3"
        android:layout_width="80dp"
        android:layout_height="80dp"
        android:layout_below="@+id/child_check_box"
        android:src="@drawable/ic_launcher" />
    


</LinearLayout>

.

1

There are 1 best solutions below

1
On

You can use this to find position of child.

 expListView.setOnChildClickListener(new OnChildClickListener() {

    @Override
    public boolean onChildClick(ExpandableListView parent, View v,
            int groupPosition, int childPosition, long id) {


        Log.e("child", (listDataHeader.get(groupPosition)).get(childPosition));

        return false;
    }
});