Android Question Deleting folders

red30

Well-Known Member
Licensed User
Longtime User
I create three folders:
File.MakeDir(File.DirInternal,"aaa")
File.MakeDir(File.DirInternal,"bbb")
File.MakeDir(File.DirInternal,"ccc")
Then I display them in the list:
Dim temp As List
temp=File.ListFiles(File.DirInternal)
The list consists of aaa, bbb, ccc.
Next, I delete the folder aaa:
File.Delete(File.DirInternal&"/aaa","")
And again I display the list:
Dim temp As List
temp=File.ListFiles(File.DirInternal)
Now the list consists of bbb, ccc.
I am adding a new folder:
File.MakeDir(File.DirInternal,"ddd")
Dim temp As List
temp=File.ListFiles(File.DirInternal)
Now the list should consist of bbb, ccc, ddd. But the list turns out ddd, bbb, ccc. Why is this happening? Why did not the ddd folder go to the end of the list?
 

red30

Well-Known Member
Licensed User
Longtime User
B4X:
File.Delete(File.DirInternal&"/ddd","")
    File.MakeDir(File.DirInternal,"aaa")
    File.MakeDir(File.DirInternal,"bbb")
    File.MakeDir(File.DirInternal,"ccc")
    Dim temp As List = File.ListFiles(File.DirInternal)
    File.Delete(File.DirInternal&"/aaa","")
    Dim temp As List = File.ListFiles(File.DirInternal)
    File.MakeDir(File.DirInternal,"ddd")
    Dim temp As List = File.ListFiles(File.DirInternal)
    Dim temp2 As List = temp
    temp2.Sort(False)

I still get: ddd,ccc,bbb
 
Last edited:
Upvote 0

Jeffrey Cameron

Well-Known Member
Licensed User
Longtime User
  1. Please use [ code ] and [ / code ] when posting language samples.
  2. Your specified sort descending in your sort, so yes, you will get D, C, B in that order.
  3. Did you look at the link I provided, there is a fine example there of creating a type and sorting it.
 
Upvote 0
Top