首页 > 解决方案 > 使用相机选项打开图像选择器

问题描述

如何打开图像选择器并显示拍照选项?

这是我的代码:

private void openFileChooser() {
    Intent intent = new Intent();
    intent.setType("image/*");
    intent.setAction(Intent.ACTION_GET_CONTENT);
    startActivityForResult(intent, PICK_IMAGE_REQUEST);
}

问题是没有打开相机选项。我该如何添加?这就是我得到的: 在此处输入图像描述

标签: javaandroidandroid-camerafilechooser

解决方案


您可以使用库或显示带有两个按钮的正常警报对话框,一个用于图库,一个用于相机。

有一个类似的问题:Dialog to pick image from gallery or from camera


推荐阅读