我正在创建适配器映像,出现以下两个错误:
android - 创建适配器镜像时,无法应用对象中的object()-LMLPHP
这是密码

public class GridViewAdapter {

    private Context mcontext;
    private int layoutResourceId;

    public GridViewAdapter(Context context, int layoutResourceId, ArrayList<Listitem> listitem) {
        super(context, layoutResourceId, listitem);
        this.layoutResourceId = layoutResourceId;
        this.mcontext =context;

    }

这是第二个错误
cannot resolve method getitem()
   ` Listitem item = getItem(position);`

if (row == null) {
            LayoutInflater inflater = LayoutInflater.from(mcontext);
            row = inflater.inflate(layoutResourceId, parent, false);
            holder = new ViewHolder();
            holder.imageTitle = (TextView) row.findViewById(R.id.text);
            holder.imageView = (ImageView) row.findViewById(R.id.imageView);
            row.setTag(holder);
        } else {
            holder = (ViewHolder) row.getTag();
        }
        Listitem item = getItem(position);

最佳答案

super尝试调用super class。您没有扩展任何内容,因此隐式地,您是从Object继承的,而又没有这样的构造函数(接受三个参数的构造函数)
变化

public class GridViewAdapter {

具有
public class GridViewAdapter extends ArrayAdapter<ListItem> {

10-08 12:23