1

I've a layout and I want all the local audio files to be displayed in its 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>

I tried to use implementation 'com.github.jaiselrahman:FilePicker:1.3.2' so inside my Activity I have this:

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);
}

This shows all the audio files on a NEW activity while I'm trying to GET all the audio files data so I can display each of them in my custom RecyclerView. For example:

each recyclerview row looks like: title artist BUTTON

Is there any way to just get all local audio files instead of show them in a new activity?

Erez git
  • 73
  • 8

0 Answers0