0

I receive multiple content URIs to gallery images with ACTION_GET_CONTENT and EXTRA_ALLOW_MULTIPLE. These images will later be uploaded to a server. The problem is that killing the activity seems to invalidate the URIs, I can't load the images anymore. Getting the same image again from the gallery returns the same URI and both the old and new URIs can be used again. I want these URIs valid after activity restart, so the selection holds for as long as the images aren't deleted. Is there some way to "refresh" the URIs I have saved? Copying the photos does not sound like a pleasant solution.

DariusL
  • 4,007
  • 5
  • 32
  • 44
  • What does "killing the activity" mean, exactly? What does "I can't load the images anymore" mean, exactly? Why are you not uploading the images immediately after the user chooses them? Permission grants, prior to Android 4.4, are temporary by design and are driven by the user's involvement (e.g., the gallery UI itself). – CommonsWare Apr 11 '15 at 19:24
  • The use might change their mind and remove the image from selection. "I can't load" means Picasso gets a SecurityException. – DariusL Apr 11 '15 at 19:27

1 Answers1

0

It works now, posted my solution here. Basically, you need two different intents for pre-kitkat and post-kitkat.

Community
  • 1
  • 1
DariusL
  • 4,007
  • 5
  • 32
  • 44