How to get onChildClick value from expandablelistview in android?

后端 未结 3 1475
陌清茗
陌清茗 2021-02-06 15:58

I am working on a project with parsing JSON from url to ExpandableListView. Depending on the \"status\" tag value (active or pending) , will be placing records accordingly to to

3条回答
  •  暗喜
    暗喜 (楼主)
    2021-02-06 16:55

    You have to use Adapter's getChild(groupPosition, childPosition) method to retrieve the instance of child and the cast it to your Map and get it working.

    @Override
    public boolean onChildClick(ExpandableListView parent, View v,
            int groupPosition, int childPosition, long id) {
    
        Toast.makeText(this, (String)((Map)
                    adapter.getChild(groupPosition, childPosition)).get("lalit"),
                                                          Toast.LENGTH_LONG).show();
        return super.onChildClick(parent, v, groupPosition, childPosition, id);
    }
    

提交回复
热议问题