问题描述
- [Android]ExpandableListView消息响应出错!麻烦帮忙看下!
-
final ExAdapter listAdapter = new ExAdapter(MeterOperateActivity.this); buttonListView.setAdapter(listAdapter); buttonListView.setGroupIndicator(null); buttonListView.setDivider(null); buttonListView.setOnGroupClickListener(new OnGroupClickListener() { @Override public boolean onGroupClick(ExpandableListView parent, View v,int groupPosition, long id) { for (int i = 0; i < listAdapter.getGroupCount(); i++) { if (groupPosition != i) { if(buttonListView.isGroupExpanded(i)){ buttonListView.collapseGroup(i); } } } return false; } });
解决方案
数组溢出了,检查一下数组长度吧
解决方案二:
获取的数组的长度是0,你取的是index = 1的,所以就报错了
时间: 2025-01-27 07:19:28