无法解析ArrayAdapter

时间:2015-04-23 16:43:21

标签: java android

我有以下代码段!我在对ArrayAdapter构造函数的超级调用上遇到错误。我无法弄清楚为什么它没有在构造函数调用中获取地图列表!

错误:无法解析方法

super(android.App.activity, int, java.util.List<java.util.Map<java.lang.String, java.lang.String>>)
public class ListAdapter extends ArrayAdapter<List<Map<String,String>>> {
    private Context m_Context;
    private String[] m_ItemName;
    private Integer[] m_ImgId;

    public ListAdapter(Activity context, List<Map<String,String>> myList) {
        super(context, R.layout.org_list_single_item, myList);
        this.m_Context=context;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        if (convertView == null) {
            convertView = LayoutInflater.from(m_Context).inflate(R.layout.org_list_single_item, parent, false);

            TextView txtTitle = (TextView) convertView.findViewById(R.id.img_dtl);
            ImageView imageView = (ImageView) convertView.findViewById(R.id.img);
            txtTitle.setText(m_ItemName[position]);
            imageView.setImageResource(m_ImgId[position]);
        }

        return convertView;
    }
}

由于

1 个答案:

答案 0 :(得分:6)

对于ArrayAdapter<T>,第三个参数应为List<T>个对象。 所以在你的情况下:List<List<Map<String,String>>>