Sunday, 27 May 2018

Showing Folder with Video File in RecyclerView

I am listing all my media files in a recycler view. Suppose a media file is in a folder, then I want to show that folder in my recycler view too. Here is my code to list media files

var projection = arrayOf(MediaStore.Video.Media.DISPLAY_NAME)
        var cursor = CursorLoader(applicationContext, MediaStore.Video.Media.EXTERNAL_CONTENT_URI,projection,null,null,null).loadInBackground()

        if(cursor!=null) {
            while (cursor.moveToNext()) {
                val name = cursor.getString(cursor.getColumnIndex(MediaStore.Video.VideoColumns.DISPLAY_NAME))
                Log.i("Main", name)
            }
            cursor.close()
        }

How can I also show the folder if a particular media file is present in a folder. Any help would be greatly appreciated.



from Showing Folder with Video File in RecyclerView

No comments:

Post a Comment