Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 定制阵列适配器,超级can';无法解决 公共类ImageAdapter扩展了ArrayAdapter{ 语境; 字符串[]PosterList; 公共图像视图(上下文上下文,字符串[]PosterList){ 超级(上下文,0,PosterList); this.context=上下文; this.PosterList=PosterList; } }_Java_Android_Android Arrayadapter - Fatal编程技术网

Java 定制阵列适配器,超级can';无法解决 公共类ImageAdapter扩展了ArrayAdapter{ 语境; 字符串[]PosterList; 公共图像视图(上下文上下文,字符串[]PosterList){ 超级(上下文,0,PosterList); this.context=上下文; this.PosterList=PosterList; } }

Java 定制阵列适配器,超级can';无法解决 公共类ImageAdapter扩展了ArrayAdapter{ 语境; 字符串[]PosterList; 公共图像视图(上下文上下文,字符串[]PosterList){ 超级(上下文,0,PosterList); this.context=上下文; this.PosterList=PosterList; } },java,android,android-arrayadapter,Java,Android,Android Arrayadapter,在上面的代码片段中,是自定义ArrayAdapter的构造函数。“超级”方法无法解决。考虑到上面写的方法签名与ArrayAdapter的android网站上的一个构造函数匹配,我不知道为什么。我怎样才能解决这个问题 因为我使用毕加索将图像下载到gridview中,所以我复制了一个字符串数组(实际上是URL),以便毕加索可以在getView方法中处理这些字符串并返回一个ImageView对象。更改 public class ImageAdapter extends ArrayAdapter<

在上面的代码片段中,是自定义ArrayAdapter的构造函数。“超级”方法无法解决。考虑到上面写的方法签名与ArrayAdapter的android网站上的一个构造函数匹配,我不知道为什么。我怎样才能解决这个问题

因为我使用毕加索将图像下载到gridview中,所以我复制了一个字符串数组(实际上是URL),以便毕加索可以在getView方法中处理这些字符串并返回一个ImageView对象。

更改

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;
    }
}
公共类ImageAdapter扩展了ArrayAdapter
...
公共图像视图(上下文上下文,字符串[]PosterList)
至(分别)

公共类ImageAdapter扩展了ArrayAdapter
...
公共ImageAdapter(上下文上下文,字符串[]PosterList)

您定义了错误的构造函数

此外,请将
ArrayAdapter
更改为
ArrayAdapter
。此外,OP还可以删除字段赋值
String[]PosterList
,因为此赋值已通过超类完成,请参见此处的代码以及
mObjects
it的所有用法contains@petey但我认为这是一个很好的编程习惯,不是吗?(我的意思是他可以通过这种方式跟踪列表视图的元素)ArrayAdapter已经做到了这一点,而且更多,看看ArrayAdapter的公共方法中包含的所有额外优点,比如(add、addall、clear、remove等)这里我不敢相信我为构造函数输入了错误的名称,甚至没有意识到这一点。谢谢你的帮助!
 public class ImageAdapter extends ArrayAdapter<ImageView>
 ...
     public ImageView(Context context, String[] PosterList)
 public class ImageAdapter extends ArrayAdapter<String>
 ...
     public ImageAdapter(Context context, String[] PosterList)