Skip to content Skip to sidebar Skip to footer

How To Get Position On Child Item In Expandablelistview In Android

I'm working with Expandable listview adapter for first time. I have a problem and not getting i single clue that how to do it.Here is view of my child item Now What i want to do is

Solution 1:

you can implement click event in adapter class see the below example here I am using ListAdapter extends BaseExpandableListAdapter{

and its the overridden method in ListAdapter , check the sample

@Overridepublic View getChildView(finalint groupPosition, finalint childPosition,
        boolean isLastChild, View convertView, ViewGroup parent) {

    finalHashMapmapBinidGrp= allItms.get(groupPosition);
    final ArrayList<ArrayList<String>> itmArys = (ArrayList<ArrayList<String>>) mapBinidGrp.get(mKEY_BIN_ITEMS);
    final ArrayList<String> childText = itmArys.get(childPosition);

    if (convertView == null) {
        LayoutInflaterinfalInflater= (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        convertView = infalInflater.inflate(R.layout.list_row_layout, null);
    }
    TextViewtxtListChild6= (TextView) convertView.findViewById(R.id.tv_one);

    txtListChild6.setOnClickListener(newOnClickListener() {
        @OverridepublicvoidonClick(View v) {
            // todo
        }
    });

    return convertView;
}

Post a Comment for "How To Get Position On Child Item In Expandablelistview In Android"