我正在创建一个可扩展列表,其中每个列表都包含一组对象(产品)。但是在获取孩子数时,我得到空指针异常并且不显示列表。
private Activity context;
private ArrayList<Product> allBmcList;
Map<ArrayList<Product>, List<String>> bmcCollection;
private List<String> Groups;
public ExpandableListAdapter(Activity context, List<String> groups,
Map<ArrayList<Product>, List<String>> bmcList) {
this.context = context;
this.bmcCollection = bmcList;
this.Groups = groups;
}
@Override
public int getChildrenCount(int groupPosition) {
// Below line I am getting null pointer exception.
return bmcCollection.get(Groups.get(groupPosition)).size();
}