What is the String 'volumeName' argument of MediaStore.Audio.Playlists.Members.getContentUri referring to?

后端 未结 2 937
灰色年华
灰色年华 2021-01-11 10:46

I am wanting to query the members of a given playlist. I have the correct playlist id, and want to use a managedQuery() to look at the playlist members in question.

2条回答
  •  北海茫月
    2021-01-11 11:24

    The String "external" works as the volume in MediaStore.Audio.Playlists.Members.getContentUri(volume, playlistId)

    This activity prints the songs on an Android, and the playlists, and their contents.

    import android.app.Activity;
    import android.database.Cursor;
    import android.net.Uri;
    import android.os.Bundle;
    import android.provider.MediaStore;
    import android.util.Log;
    
    public class PlaylistActivity extends Activity {
        private final String [] STAR= {"*"};
        private final String TAG= "list";
    
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            //setContentView(R.layout.main);
    
            Log.i(TAG, "All the titles");
            Uri allaudio_uri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI;
            Cursor ca= managedQuery(allaudio_uri, STAR, null,null,null);
            for(ca.moveToFirst(); !ca.isAfterLast(); ca.moveToNext()){
                if(ca.isFirst()){   // print all the fields of the first song
                    for(int k= 0; k

提交回复
热议问题