I am making an app where I need to open an image in the gallery and then return back to the app when user press back button.
I read some answers here for opening an image in the gallery and this is what I am using now -
ACTION - android.intent.action.VIEW
DATA TYPE - image/*
DATA URI - an exact path of the image
The app opens the image successfully in “Photos” app but after opening the image, app is being crashed and doesn’t go anywhere even after pressing many back button. I have to restart the app to access the app again.
The solution says I have to set Flags to FLAG_ACTIVITY_NEW_TASK. I am not able to find the right solution to avoid the app crash so that I can return back to the app after opening an image to the Gallery.
If anyone has a solution or any idea then please help.