【发布时间】:2014-03-07 07:17:14
【问题描述】:
ArrayList<HashMap<String, ?>> list;
f(!list.isEmpty()){
adapter = new MySimpleArrayAdapter(getActivity(),R.layout.inner_base_header_cutom, list);
listview.setAdapter(adapter);
Log.i("LIST Active", "LIST Active" + list.size());
}
public class MySimpleArrayAdapter extends ArrayAdapter<ArrayList<HashMap<String, ?>>> {
private final Context context;
private final ArrayList<HashMap<String, ?>> values;
public MySimpleArrayAdapter(Context context, int innerBaseHeaderCutom, ArrayList<HashMap<String, ?>> list) {
super(context, innerBaseHeaderCutom, list);
this.context = context;
this.values = list;
}
}
错误:
The constructor ArrayAdapter<ArrayList<HashMap<String,?>>>(Context, int, ArrayList<HashMap<String,?>>) is undefined
也无法移除 ListView:
remove(list.get(position));
错误:
The method remove(ArrayList<HashMap<String,?>>) in the type ArrayAdapter<ArrayList<HashMap<String,?>>> is not applicable for the arguments (HashMap<String,capture#2-of ?>)
【问题讨论】:
-
代码中的列表是什么?
-
` ArrayList
>`,我在上面添加了一些。 -
ArrayList<HashMap<String, ?>> list为什么是?。它们的值不是字符串吗?还有你在哪里填充列表 -
也许尝试使用
List而不是ArrayList? -
@lordzden 检查我的答案...
标签: java android android-listview arraylist