java - 拍照时如何开启原生编辑图片?

标签 java android android-camera-intent

当我使用原生相机拍照时,我得到了这个:

enter image description here

当我点击它时,它会显示一个编辑选项:

enter image description here enter image description here

但是,在我的应用程序中,当我使用以下代码调用打开相机并拍照的 Intent 时:

Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
intent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri);
startActivityForResult(intent, PICTURE_RESULT);

不知何故,它不再显示该编辑选项。它只提供检查和关闭图标:

enter image description here

如果原生相机可以打开它,我相信应该有一种方法可以通过 Intent 代码将其设置在那里。

我知道不是所有的安卓手机都支持这个。但是,至少,我想为拥有它的人提供该编辑功能。

最佳答案

试试这个 Intent intent= new Intent(Intent.ACTION_EDIT); intent.setDataAndType(uri, "image/*"); intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); startActivity(Intent.createChooser(intent, null)); 但实际上最好的方法是使用谷歌相机 API 构建自己的相机应用

关于java - 拍照时如何开启原生编辑图片?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58131548/

相关文章:

Android SearchView - 向右移动图标(没有 ActionBar)

Android:从相机拍摄图像并裁剪

android - 如何将捕获的图像传递给不同的 Activity 以设置为android中的 ImageView

Android相机Intent设置分辨率

java - 将一串数字拆分为单独的数字

java - Swing:重置 ObjectOutputStream 时出现 EDT NullPointerException

java - 理解使用 Zend 框架用 PHP 编写的代码

Java 线程 : Wait don't work as expected

android - 在 Android studio 中卡在调试消息 "Waiting for Debugger"

java - 获取给定值并使用映射器在 DynamoDB 中搜索它