java - 使用 ACTION_IMAGE_CAPTURE 从相机拍摄照片后如何跳过或避免 'retake and review' 选项

标签 java android camera android-camera android-camera-intent

我想在点击照片时显示图像,并想在我的 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.....

enter image description here

最佳答案

其实拍照确认还是很有用的。但是,如果您真的不想拥有它,则必须在您的应用程序中使用 SurfaceView 并在此处显示相机流。有如何做的例子,例如考虑检查 one .

关于java - 使用 ACTION_IMAGE_CAPTURE 从相机拍摄照片后如何跳过或避免 'retake and review' 选项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38581244/

相关文章:

java - 如何在Spring-Quartz中使用“MethodInvokingJobDetailFactoryBean”创建“targetObject”的原型(prototype)实例?

javascript - Android webview,在 Assets 文件夹中加载javascript文件

ios 9 - xcode 7 - SFSafariViewController - 图片上传 - 相机黑屏

python - pygame.camera "livefeed"在 tkinter 窗口内(在 raspbian 上)

java - 如何比较两个 HashMap

java - java中高度可整除的三角形数: Program inefficiency

java - Android LocationManager,粗略数据和电池消耗

android - 错误 "Unable to find resource id "

android - 如何使用 LoopBack Android SDK 通过 GeoPoint 创建模型

c++ - GLFW 相机和鼠标控制