如何解决使用FilePicker接收我的智能手机的所有音频文件,并在CUSTOM recyclerview上显示它们
我有一个布局,我希望所有本地音频文件都显示在其recyclerview中:
the local songs should be displayed in the green border
<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>
我尝试使用实现'com.github.jaiselrahman:FilePicker:1.3.2',所以在我的Activity中,我有这个:
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);
}
当我尝试获取所有音频文件数据时,这将显示一个新活动中的所有音频文件,以便可以在我的自定义RecyclerView中显示每个音频文件。例如:
每个recyclerview行看起来像: 标题艺术家按钮
有什么方法可以获取所有本地音频文件,而不是在新活动中显示它们?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。