简体   繁体   English

使用自定义 ArrayAdapter 时无法解析方法 super

[英]can't resolve method super when using custom ArrayAdapter

I'm trying to use ListView with custom ArrayAdapter, however when I try to call super in the constructor, it gives me this error :我正在尝试将 ListView 与自定义 ArrayAdapter 一起使用,但是当我尝试在构造函数中调用super时,它给了我这个错误:

cannot resolve method'(android.content.Context, int, java.lang.String)无法解析方法'(android.content.Context, int, java.lang.String)

Here's my piece of code这是我的一段代码

public class MobileArrayAdapter extends ArrayAdapter<String> {
private final Context context;
private final String values;

public MobileArrayAdapter(Context context, String values) {
    super(context, R.layout.activity_second,values);
    this.context = context;
    this.values = values;
}

what did I miss?我错过了什么? thanks in return!感谢回报!

You constructor should pass a String array or String Arraylist in super.您的构造函数应该在 super 中传递一个 String 数组或 String Arraylist。

The error says that you don't have a super constructor with just a string as a parameter错误说你没有一个只有一个字符串作为参数的超级构造函数

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM