【发布时间】:2015-05-04 07:45:36
【问题描述】:
我正在尝试为可扩展列表视图设置适配器,如下所示:
public class CompanyProfileAdapter extends BaseExpandableListAdapter {
Context context;
ArrayList<SearchListView> searchresultList;
ArrayList<IndustryListView> industryListViews;
public CompanyProfileAdapter(Context context,
ArrayList<IndustryListView> industryListViews,
ArrayList<SearchListView> searchresultList) {
// TODO Auto-generated constructor stub
this.context = context;
this.searchresultList = searchresultList;
this.industryListViews = industryListViews;
}
@Override
public Object getChild(int groupPosition, int childPosition) {
// TODO Auto-generated method stub
return industryListViews.get(this.searchresultList.get(groupPosition)).get(childPosition);
}
这里我收到以下错误:“ArrayList 类型中的方法 get(int) 不适用于参数 (SearchListView)”
在上述代码的最后一行。谁能帮我解决这个问题。
【问题讨论】:
-
你在哪一行出现错误?你能发布你的堆栈跟踪
-
很抱歉给您带来了困惑。我在 getChild() 方法的返回语句中遇到错误。
-
方法 -> industryListViews.get(int index) 接受 int,而不是 SearchListView。
标签: android listview android-adapter expandablelistadapter expandable