我正在使用 ACTION_EDIT Intent 启动 Android 图像编辑器以编辑图像:
Intent editIntent = new Intent(Intent.ACTION_EDIT);
editIntent.setDataAndType(uri, "image/*");
启动带有结果的 Intent 时,如何检索编辑/保存图像的路径?
最佳答案
I am using the ACTION_EDIT intent to launch the Android image editor in order to edit an image
请记住,Android 没有图像编辑器。某些 Android 设备可能附带图像编辑器,而某些用户可能已经从 Play 商店或其他分发 channel 安装了图像编辑器。
此外,由于您知道 uri
的 MIME 类型是什么,如果将真实的 MIME 类型放入您的 Intent
中,您将获得更好的结果。
When launching the intent with result, how do I retrieve the path of the edited / saved image?
首先,ACTION_EDIT
不支持“用结果启动 Intent ”,我将其解释为 startActivityForResult()
。作为the ACTION_EDIT
documentation状态,没有输出。只需使用 startActivity()
。
除此之外,您是为编辑器提供 Intent
中的 Uri
的人,因此在那个时候,您已经知道 是什么Uri
是你交给编辑的。在您保存的实例状态中保留该 Uri
,这样您就可以确保您拥有 Uri
,即使 Android 在用户编辑图像时终止了您的进程。虽然没有要求 ACTION_EDIT
Intent
将编辑后的图像保存回用于加载图像的 Uri
指定的位置,但希望大多数 ACTION_EDIT
Activity 就是这样做的。
关于Android图像编辑器 Intent : retrieving saved file location,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31640029/