cannot resolve method :super()是什么意思
时间: 2024-01-25 07:04:27 浏览: 234
“cannot resolve method :super()”是一个Java编译器错误。它表示在当前类的构造函数中,调用了父类的构造函数,并使用了“super()”语法,但是编译器无法找到父类的构造函数。这个错误通常是因为父类中没有无参构造函数,或者子类没有正确地调用父类的构造函数。解决这个错误的方法是在子类的构造函数中显式地调用父类的构造函数,或者在父类中添加一个无参构造函数。
相关问题
cannot resolve method error in logger
The "cannot resolve method" error in a logger indicates that the method being called does not exist in the logger's class or in any of its superclasses. This error can occur if you are using an outdated version of the logger or if you have misspelled the method name.
To resolve this error, make sure that you are using the correct version of the logger and that you have spelled the method name correctly. You can also check the logger's documentation or source code to ensure that the method you are trying to call actually exists.
Cannot resolve method 'findViewById' in 'MediaViewHolder
这个错误通常表示你在一个非 Activity 或 Fragment 的类中调用了 `findViewById` 方法。该方法只能在 Activity 或 Fragment 类中使用。
如果你在一个非 Activity 或 Fragment 的类中需要使用 `findViewById` 方法,你可以将它们传递给该类或使用 `LayoutInflater` 来获取视图,例如:
```java
public class MediaViewHolder extends RecyclerView.ViewHolder {
private ImageView mImageView;
public MediaViewHolder(View itemView) {
super(itemView);
mImageView = itemView.findViewById(R.id.imageView);
}
public void bind(Media media) {
// 使用 mImageView 显示媒体信息
}
}
```
另外,确保你已经正确地导入了 `android.view.View` 和 `android.widget.ImageView`。
阅读全文