具有自定义路径的listview音频播放

时间:2018-09-03 13:19:30

标签: android listview audio-player android-music-player

这是音乐播放器光标;它的工作原理很好,它显示了从sdcard到listview的所有歌曲,但是我只想要特定的文件夹,如何在查询时添加自定义文件夹路径?

musicAdapter = new RecordPlayerAdapter(this);

    Cursor musicCursor = getContentResolver().query(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, null, null, null, null);
    if (musicCursor != null && musicCursor.moveToFirst()) {
        do {
            musicAdapter.add(new RecordPlayerBridge(
                    musicCursor.getString(musicCursor.getColumnIndex(MediaStore.Audio.Media.TITLE)),
                    musicCursor.getLong(musicCursor.getColumnIndex(MediaStore.Audio.Media.DURATION)),
                    musicCursor.getString(musicCursor.getColumnIndex(MediaStore.Audio.Media.DATA))
            ));
        } while (musicCursor.moveToNext());
    }

1 个答案:

答案 0 :(得分:0)

您需要添加所需的文件夹作为查询参数

代码:

const config = new MatSnackBarConfig();

config.panelClass = ['message-position'];

let snackBarRef = this._matSnackBar.openFromComponent(SnackbarMessageComponent, config);


 ::ng-deep .message-position {
        position: fixed;
        left: 50%;
        top: 50%;
        transform: translate3d(-50%,0,0) !important;
    }

希望它能解决您的问题。