更新到Android Studio 3.2之后,我从皮棉上得到了一个“可能的错误”:
"Not annotated method overrides method annotated with @NonNull".
Run Code Online (Sandbox Code Playgroud)
在更新到Android Studio 3.2之前,我没有任何问题,该如何解决?
@NonNull
@Override
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
View row = convertView;
ViewHolder holder;
if (convertView == null) {
holder = new ViewHolder();
row = LayoutInflater.from(context).inflate(R.layout.gallery_view_row, parent, false);
holder.imageView = row.findViewById(R.id.filePath);
row.setTag(holder);
} else holder = (ViewHolder) row.getTag();
String file_path = objects.get(position);
GlideApp.with(context).load(MovieDB.IMAGE_URL + context.getResources().getString(R.string.galleryImgSize) + file_path)
.into(holder.imageView);
return row;
}
Run Code Online (Sandbox Code Playgroud)
Android Lint在Android Studio 3.2更新之前从未标记过此方法,但是现在我在该方法和“ parent”参数上得到了2个标记
这是使用的2种进口商品
import androidx.annotation.NonNull;
import androidx.annotation.Nullable; …Run Code Online (Sandbox Code Playgroud)