Issue
I am using the ACTION_EDIT intent to launch the Android image editor in order to edit an image:
Intent editIntent = new Intent(Intent.ACTION_EDIT);
editIntent.setDataAndType(uri, "image/*");
When launching the intent with result, how do I retrieve the path of the edited / saved image?
Solution
I am using the ACTION_EDIT intent to launch the Android image editor in order to edit an image
Bear in mind that Android does not have an image editor. Some Android devices might ship with an image editor, and some users may have installed an image editor off of the Play Store or other distribution channels.
Also, since you know what the MIME type is of uri
, you will have better results if you put the real MIME type into your Intent
.
When launching the intent with result, how do I retrieve the path of the edited / saved image?
First, ACTION_EDIT
does not support "launch the intent with result", which I am interpreting as meaning startActivityForResult()
. As the ACTION_EDIT
documentation states, there is no output. Just use startActivity()
.
Beyond that, you are the one who provided the Uri
in the Intent
for the editor, so at that point in time, you already knew what the Uri
was that you handed to the editor. Hang onto that Uri
in your saved instance state, so that you can ensure that you have the Uri
even if Android terminates your process while the user is editing the image. While there is no requirement that an ACTION_EDIT
Intent
save the edited image back to the location specified by the Uri
used to load the image, one hopes that most ACTION_EDIT
activities do just that.
Answered By - CommonsWare
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.