0

当使用以下代码从我的画廊中选择一张图片时,我还可以选择拍摄一张新照片,当我这样做时,它会保存它(在默认图片库中),我可以选择该图片。

Intent intent = new Intent();
        intent.setType("image/*");
        intent.setAction(Intent.ACTION_GET_CONTENT);
        startActivityForResult(
                Intent.createChooser(intent, "Select Picture"),
                PICK_IMAGE);

我的最终目标是有两个选项“从图库中选择”和“拍照”。我的问题 - 有没有办法通过上述意图自动启动相机,可能还有一些额外的东西?

我并不是说使用相机意图:

Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");

在使用相机意图进行测试时,我遇到了两个主要错误:确定按钮错误和小图像返回,所以我想知道我的其他方法是否可行。可能不是,但值得一试..?

4

1 回答 1

1

据我所知,答案是否定的。最好的方法是让他们Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");玩得很好。即使有可能,用户交互也会不直观且令人困惑,因为没有“接受照片”按钮/交互。

于 2011-03-12T16:54:22.413 回答