0

I'm using the following method to launch an Activity that allows me to pick a song from the MediaStore library and return a uri for it to the launching activity.

public void selectMedia()
{
        Intent i = new Intent(Intent.ACTION_PICK, MediaStore.Audio.Media.EXTERNAL_CONTENT_URI);
        startActivityForResult(i, REQUEST_MEDIA);
}

I've been searching and searching for a way to filter the list that is shown so that it doesn't include alarms and ringtones. Since I couldn't find a solution for it I started looking for a way to specify a "root dir" in which the media files should be in.

All I find is much more complex examples on how to query the MediaStore as a ContentProvider for specific results and then display the results in a custom ListView.

I'm curious to find an answer to if this is the only way to achieve what I'm trying to do or if it is possible to solve by passing some extra information with the intent.

span
  • 5,405
  • 9
  • 57
  • 115
  • you want the **complete action using** dialog to be different , or the selection that you get in music player to be different? – nandeesh Sep 25 '12 at 14:09
  • Well, I would like the activity that is showing the media content to only contain music tracks (or at least not alarms and ringtones). If that is not possible, I would like to send a folder like "/sdcard/music" together with the intent to limit the results displayed to that specific folder and its children. I'm not concerned with the "complete action using" dialog. – span Sep 25 '12 at 14:12

1 Answers1

0

No, it does not seem possible at this time. I ended up writing my own activity for selection and it queries the media store as appropriate.

The solution can be found here:

I have written my own solution for this now, anyone who needs it can find it here

https://stackoverflow.com/a/12710411/1068167

Community
  • 1
  • 1
span
  • 5,405
  • 9
  • 57
  • 115