2
votes

In "developer options" settings I use "don't keep activities" mode. I need pick image from gallery and use its URI in my application. The code which opens the gallery in order to pick image is:

Intent intent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
intent.setType(FileType.IMAGE);

startActivityForResult(intent, 1);

The issue happens when I pick image. "Please wait..." message is shown and then I turned back to the "select image" in gallery. It happens in HTC One X device when this mode is turned on. In Samsung Galaxy S3 this issue doesn't occur. How can I solve it on HTC ONE X device when this mode is on?

2
Why are you using that setting? It's meant for debugging purposes.Stealth Rabbi
We use it for debugging purpose, but I think that users can also set this setting and they will receive wrong behavior.Eugene
It is a debugging option to help simulate real life situations. For example: the user goes to the gallery, receives a 10 minute long phone call and then picks a photo - your activity may easily have been released by the system to restore resources. If there is a bug with this option turned on, you shouldn't ignore it.FunkTheMonk
But, I don't understand the behavior difference between HTC One X and other devices. The problem is only in specific device.Eugene
I'm having the same on HTC Desire 500. I guess it's a feature specific to HTC.durilka

2 Answers

0
votes

Try this

Intent photoPickerIntent = new Intent(Intent.ACTION_PICK);
photoPickerIntent.setType("image/*");
startActivityForResult(photoPickerIntent, 1);

The 1 is the request code passed to the activity to differentiate multiple activities called.

0
votes

I switched to Intent.ACTION_GET_CONTENT with just mime-type and it seems to work better. I guess an HTC bug.

    Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
    intent.setType("image/*");