我是原生安卓开发的新手。我正在安卓工作室工作。我有3 tabs
.一个是map
第二个是camera
拍照,第三个是pictures
,其中所有拍摄的照片都要展示。我已经实现了map
和camera
,为了查看图像,我正在遵循本教程。在我添加的类中Bitmap image = Bitmap image = decodeFile(_filePaths.get(position), imageWidth, imageWidth);
但它向我展示了错误Cannot Resolve method decodeFile
.我已经搜索了它,但找不到任何解决方案。
下面是我的代码
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ImageView imageView;
if (convertView == null) {
imageView = new ImageView(_activity);
} else {
imageView = (ImageView) convertView;
}
// get screen dimensions
Bitmap image = decodeFile(_filePaths.get(position), imageWidth, imageWidth);
imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
imageView.setLayoutParams(new GridView.LayoutParams(imageWidth,
imageWidth));
imageView.setImageBitmap(image);
// image view click listener
imageView.setOnClickListener(new OnImageClickListener(position));
return imageView;
}
任何帮助将不胜感激。
类中定义的自定义方法(在教程中,您应该错过复制名为decodeFile()的方法)再次检查.。
使用这个
Bitmap image = BitmapFactory.decodeFile(_filePaths.get(position), imageWidth, imageWidth);