Android Question File DirDefaultExternal

carloz

Member
Licensed User
Longtime User
hi all,

Am copying some files from dirassets to dirdefaultexternal . I can see the files in filemanager once copied.
Then, i am trying to show those files in a listbox using following code..
B4X:
Sub ListFolderContent(folder As String) As String
  Dim fileList As List
  Dim n As Int

  fileList = File.ListFiles(root)
  fileList.Sort(True)

  For n = 0 To fileList.Size-1
        file1 = fileList.Get(n)
      If(file1.Contains(".mp4")) Then
      ListView1.AddSingleLine(file1)
      End If
  Next
End Sub

also tried
B4X:
Sub ListFiles(dir As String)
Dim list_files As List
Dim lista_folders As List
lista_folders.Initialize
    list_files=File.ListFiles(dir)
    For i= 0 To list_files.Size -1
        If File.IsDirectory(dir, list_files.Get(i))=False Then
            lista_folders.Add(list_files.Get(i))
        End If
    Next
Return lista_folders
End Sub


but in both cases no files are returned in the list...does file.ListFiles not work on dirDefaultExternal ?
if not..what other way to get filelist from that folder?

regards
carloz
 

carloz

Member
Licensed User
Longtime User
thnx erel

then what could possibly be going wrong
the files are there..i can even open the files with intent .. but no list..

carloz
 
Upvote 0

carloz

Member
Licensed User
Longtime User
erel ..
just tried this.. instead of extracting to dirDefaultExternal , i extracted all files from dirAssets to dirDefaultExternal & "/media/".
And the filelist worked perfectly.. !!!!
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…