我想在点击照片时显示图像,并想在我的 ImageView 中设置而不需要用户选择是或否....
我搜索过它,我也很清楚相机应用程序本身可以让您查看/重新拍摄图像,一旦图像被接受, Activity 就会显示它。但是,我想在不审查/重新进行 Activity 的情况下进行显示它.....
我正在尝试这段代码
初始化
Uri mImageCaptureUri;
点击按钮
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_SCREEN_ORIENTATION, ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
File file = new File(Environment.getExternalStorageDirectory(),
"tmp_avatar_" + String.valueOf(System.currentTimeMillis()) + ".jpg");
mImageCaptureUri = Uri.fromFile(file);
try {
intent.putExtra(MediaStore.AUTHORITY, true);
intent.putExtra("return-data", true);
intent.putExtra(MediaStore.EXTRA_OUTPUT, mImageCaptureUri);
startActivityForResult(intent, PICK_FROM_CAMERA);
} catch (Exception e) {
e.printStackTrace();
}
onActivityResult
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
Bitmap bitmap = null;
mPath = mImageCaptureUri.getPath();
System.out.println("THE PAtH:_" + mPath);
BitmapFactory.Options o2 = new BitmapFactory.Options();
bitmap = BitmapFactory.decodeFile(mPath, o2);
ivSelfie.setImageBitmap(bitmap);
}
When I am Click the Photo Than I am Take this screen to select yes or not......
But My requirement is not select review/retake task and direct set to ImageView on activity display when just click and set.....
最佳答案
其实拍照确认还是很有用的。但是,如果您真的不想拥有它,则必须在您的应用程序中使用 SurfaceView 并在此处显示相机流。有如何做的例子,例如考虑检查 one .
关于java - 使用 ACTION_IMAGE_CAPTURE 从相机拍摄照片后如何跳过或避免 'retake and review' 选项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38581244/