【发布时间】:2018-02-23 07:06:53
【问题描述】:
我有一个片段,其中列表视图有一个按钮调用警报对话框,其中包含一些要填充的信息,例如需要使用相机捕获的图像设置的 imageView 我该怎么做
采取的步骤
在 ListViewAdapter 类中
private void camerafirstOnClickEventHandler(int num) {
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
fileUriLandAdapter = getOutputMediaFileUri(MEDIA_TYPE_IMAGE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUriLandAdapter);
if (num == 2) {
((Activity) con).startActivityForResult(intent, CAMERA_REQ2);
}
}
public void previewCapturedImage(ImageView imageView, Uri uri) {
try {
BitmapFactory.Options options = new BitmapFactory.Options();
options.inSampleSize = 4;
final Bitmap bitmap = BitmapFactory.decodeFile(uri.getPath(),
options);
imageView.setImageBitmap(bitmap);
arrBitmaps.add(bitmap);
} catch (NullPointerException e) {
e.printStackTrace();
}
}
在片段类中
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
// if the result is capturing Image
landAdapter.previewCapturedImage(landAdapter.uprootImage,landAdapter.fileUriLandAdapter);
}
但 PreviewCapturedImage 没有被调用
【问题讨论】:
-
可以用
listeners完成 -
你能把代码贴一下吗
标签: android listview android-fragments popup android-alertdialog