Android 接收我所有的智能手机&x27;使用FilePicker创建音频文件,并将其显示在自定义recyclerview上

Android 接收我所有的智能手机&x27;使用FilePicker创建音频文件,并将其显示在自定义recyclerview上,android,android-recyclerview,filepicker,Android,Android Recyclerview,Filepicker,我有一个布局,我希望所有本地音频文件都显示在其recyclerview中: 当我试图获取所有音频文件数据时,这会显示新活动中的所有音频文件,以便我可以在自定义的RecyclerView中显示每个音频文件。例如: 每个recyclerview行如下所示: 标题艺术家按钮 有没有办法只获取所有本地音频文件而不在新活动中显示它们?文件选择器不能用于此目的。改为查询媒体存储。 <androidx.constraintlayout.widget.ConstraintLayout xmlns

我有一个布局,我希望所有本地音频文件都显示在其recyclerview中:

当我试图获取所有音频文件数据时,这会显示新活动中的所有音频文件,以便我可以在自定义的RecyclerView中显示每个音频文件。例如:

每个recyclerview行如下所示: 标题艺术家按钮


有没有办法只获取所有本地音频文件而不在新活动中显示它们?

文件选择器不能用于此目的。改为查询媒体存储。
<androidx.constraintlayout.widget.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@android:color/white"
    tools:context=".MainActivity">

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/image_view_background"
        android:background="@drawable/background_songbook"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"/>

    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/recyclerView"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        app:layout_constraintBottom_toTopOf="@+id/bottom_navigation"
        app:layout_constraintTop_toBottomOf="@+id/image_view_background"
        tools:listitem="@layout/item_song"/>

    <com.google.android.material.bottomnavigation.BottomNavigationView
        android:id="@+id/bottom_navigation"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:layout_constraintBottom_toBottomOf="parent"
        app:itemIconTint="@drawable/navigation_selected_color"
        app:itemTextColor="@drawable/navigation_selected_color"
        app:menu="@menu/bottom_navigation_menu"
        app:itemBackground="@android:color/black"/>

</androidx.constraintlayout.widget.ConstraintLayout>
private void showLocalSongsOnRecyclerView() {
    Intent intent = new Intent(this, FilePickerActivity.class);
    intent.putExtra(FilePickerActivity.CONFIGS, new Configurations.Builder()
            .setCheckPermission(true)
            .setShowAudios(true)
            .setShowImages(false)
            .setShowVideos(false)
            .setShowFiles(false)
            .setSingleClickSelection(true)
            .setSkipZeroSizeFiles(true)
            .build());
    startActivityForResult(intent, REQUEST_CODE_LOCAL_SONG_PICKED);
}