java - 使用相机选项打开图像选择器
问题描述
如何打开图像选择器并显示拍照选项?
这是我的代码:
private void openFileChooser() {
Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(intent, PICK_IMAGE_REQUEST);
}
解决方案
您可以使用此库或显示带有两个按钮的正常警报对话框,一个用于图库,一个用于相机。
推荐阅读
- c - 观察 PAPI 的 L1_MISS 本机事件计数器的意外结果
- azure - 通过 ARM 模板在 Azure Web App 中为容器启用持续部署
- magento-2.3 - 将 Magento-2.2.6 升级到 2.3.1
- c# - 如何使用实体框架核心调用没有主键的表
- node.js - 为什么当我使用模块 vue-template-compiler 加载站点时尝试渲染页面时出现错误?
- c# - 如果在 c# 中该类的任何方法中发生异常,则创建一个捕获异常的方法
- python-3.x - 使用python获取sharepoint页面
- ios - 移动设备上的 Azure App Service 身份验证问题
- javascript - 使用 Postman 时,我们可以像变量一样在 for 循环中增加全局变量名称吗
- google-apps-script - 如何将多个文件上传保存在特定文件夹中?