1. *** New version of B4J is available ***
    B4J v7.8
    Dismiss Notice

Android Question List videos by folder

Discussion in 'Android Questions' started by Sasuke Sama, Jun 8, 2019.

  1. Sasuke Sama

    Sasuke Sama Active Member Licensed User

    Im using the medaiabrowser lib to get a list of the videos on a device but im trying to show them by folders like mx player and any other video players
    dose anyone have an idea on where to start?
  2. DonManfred

    DonManfred Expert Licensed User

    You can use the File methods to list them by yourself.
    You may have a look at the ClassWildcards to get some inspiration.

    For external sdcards you need to use the StorageAccessFramework. Note that the Classwildcard does not work on external sdcards.

    You need to build your own solution.
  3. Sasuke Sama

    Sasuke Sama Active Member Licensed User

    Dont think its good for my situation
    The app is a video player app so i need the mb lib to get not only the video list but the thumb and other stuff
    We'll see what other members suggestions
  4. Brian Dean

    Brian Dean Member Licensed User

    I think that I agree with DonManfred. Making a list of files with a known extension is quite straightforward. This code will start from a specified folder [path] and recursively list all the files with a specific entension [extn]. The output is in the list [result].

    Sub findFiles(path As String, extn As String, result As List)
    Dim files As List = File.ListFiles(path)
    If (files.IsInitialized) Then
    For Each f As String In files
    If (File.IsDirectory(path, f)) Then
    path & "/" & f, extn, result)
    If (f.EndsWith(extn)) Then
    path.Replace(File.DirRootExternal, "") & "/" & f)
    End If
    End If
    End If
    End Sub
    You might want to use a list of media file extensions, and you will have to sort out the results list into folder groups, but that is not very difficult and you will have a completely flexible solution.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice