0

I'm writing an application that will allow the user to select multiple music tracks from the sd-card and play them. I'm trying to use the Intent system to select multiple media instances but I can only find a way to pick a single item.

This is the code I'm using:

Intent i = new Intent(Intent.ACTION_PICK, MediaStore.Audio.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(i, REQUEST_MEDIA);

Since there is an action "ACTION_SEND_MULTIPLE" I thought there would be a multiple version of the pick action as well but I can't find any. So, is it possible and if so, what is the action to use?

span
  • 5,405
  • 9
  • 57
  • 115

1 Answers1

2

I unfortunately faced the same problem. There is NO way to select multiple items with Intent.ACTION_PICK. The way i took was to create my own custom GridView for the user to select multiple items. You could take a similar approach of showing all the mp3 files in a customized view.

Royston Pinto
  • 6,681
  • 2
  • 28
  • 46
  • Thanks for the feedback, I guess I will make a ListView with checkboxes for the selections. Really hoping another solution will pop up though :P. Will mark yours as a solution in a couple of days if nothing else shows up. – span Sep 25 '12 at 09:07
  • Yes, Thats a good way out, most of the market apps, even photo editing ones do not allow multiple photo selection :-o, lets see if we do get a good sloution :) i would use it too! – Royston Pinto Sep 25 '12 at 09:11
  • I ended up writing my own activity to handle this. Thanks for your time :). Unfortunately my implementation is not very generic so I don't think it would be of much use to anyone else. I'll gladly post it to anyone leaving a comment on this issue though. – span Sep 27 '12 at 13:30
  • I have written my own solution for this now, anyone who needs it can find it here: http://stackoverflow.com/a/12710411/1068167 – span Oct 03 '12 at 14:16
  • No longer true, you can now actually select multiple files. With a fallback to singular for older devices. – Mathijs Segers Feb 09 '15 at 15:21