My app launches the gallery to choose a photo. In the meantime, my app gets killed by the operating system, so that when I select the image my app needs to start up all over again.
NOTE: this is a transient issue. It often works just fine.
When it fails, there is nothing at all in the logs to indicate that a anything went wrong.
The gallery is launched in the usual way via Intent.ACTION_GET_CONTENT
.
Why is my app being terminated? I can only assume it is a memory issue (caused by the Gallery app?), except that:
It happens with small images, too.
When it works successfully my app has no issues processing the images.
I'm using
android:largeHeap="true"
.activityManager.getMemoryClass()
= 256MB.The issue happens more often when the debugger is connected.
A photo, even uncompressed, is probably no more than 30MB. At the time of launching the gallery, my system has 199MB available.
Even when the app restarts, the onActivityResult
method is still called, so I can still resume the upload, but it makes for a very slow process and an awful user experience.
(Running Jellybean on Samsung Galaxy S3)