自定义ArrayAdapter,super无法解析
Custom ArrayAdapter, super can't be resolved
public class ImageAdapter extends ArrayAdapter<ImageView> {
Context context;
String[] PosterList;
public ImageView(Context context, String[] PosterList){
super(context, 0, PosterList);
this.context = context;
this.PosterList = PosterList;
}
}
所以在上面的代码片段中,是自定义 ArrayAdapter 的构造函数。 "super"方法无法解析。我不确定为什么,考虑到上面写的方法签名与 ArrayAdapter 的 android 网站上的构造函数之一相匹配。我该如何解决这个问题?
因为我使用 Picasso 将图像下载到 gridview 中,所以我复制了一个字符串数组(实际上是 URL),以便 Picasso 在 getView 方法中处理它们,return ImageView 对象。
改变
public class ImageAdapter extends ArrayAdapter<ImageView>
...
public ImageView(Context context, String[] PosterList)
到(分别)
public class ImageAdapter extends ArrayAdapter<String>
...
public ImageAdapter(Context context, String[] PosterList)
您定义了错误的构造函数。
public class ImageAdapter extends ArrayAdapter<ImageView> {
Context context;
String[] PosterList;
public ImageView(Context context, String[] PosterList){
super(context, 0, PosterList);
this.context = context;
this.PosterList = PosterList;
}
}
所以在上面的代码片段中,是自定义 ArrayAdapter 的构造函数。 "super"方法无法解析。我不确定为什么,考虑到上面写的方法签名与 ArrayAdapter 的 android 网站上的构造函数之一相匹配。我该如何解决这个问题?
因为我使用 Picasso 将图像下载到 gridview 中,所以我复制了一个字符串数组(实际上是 URL),以便 Picasso 在 getView 方法中处理它们,return ImageView 对象。
改变
public class ImageAdapter extends ArrayAdapter<ImageView>
...
public ImageView(Context context, String[] PosterList)
到(分别)
public class ImageAdapter extends ArrayAdapter<String>
...
public ImageAdapter(Context context, String[] PosterList)
您定义了错误的构造函数。