Opening Image in Gallery Causing App Crash

Hello All,

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.

I was looking for a solution in Google and here what I found - java - Open gallery app from Android Intent - Stack Overflow

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.

Thanks!

1 Like

You should use image picker instead of Activity Starter

1 Like

More information or piece of blocks about using the Image Picker to open a image will be appreciated.

1 Like

just drag and drop ImagePicker Component from Media.

and Set Blocks from Image Picker Block

  • When ImagePicker1 Click - Call ImagePicker1 Open

it will open Gallery for you.

1 Like

Okay, I want to open a specific image (will provide the path of image), not only gallery.

1 Like

Then set an image component’s picture to /path/to/image.extension

2 Likes

I think Image component will open the image in app but I want to open an image for given path in phone’s gallery.

If you mean something else then please explain a little bit more.

1 Like