hi
i am trying to check if a file i get from File.ListFiles(...) is a directory but i am getting a crash.
i am targeting sdk26 and i request the permission to _WRITE_EXTERNAL_STORAGE so that should not be the problem.
this is my code:
i also tried to remove "/" before the file name but did not worked.
this is the crash log:
any idea what is wrong?
i also need to mention that some files are written in hebrew, could that be the reason?
thanx, ilan
i am trying to check if a file i get from File.ListFiles(...) is a directory but i am getting a crash.
i am targeting sdk26 and i request the permission to _WRITE_EXTERNAL_STORAGE so that should not be the problem.
this is my code:
B4X:
Dim list1 As List
list1.Initialize
list1 = File.ListFiles(File.DirRootExternal)
Log("size: " & list1.Size)
For x = list1.Size-1 To 0 Step -1
If File.IsDirectory(File.DirRootExternal, "/" & list1.Get(x)) = False Then
list1.RemoveAt(x)
End If
Next
i also tried to remove "/" before the file name but did not worked.
this is the crash log:
SENTINEL_MSG_LIBCUTILS
SENTINEL_MSG_LIBLOG
size: 92
menu$ResumableSub_phoneout_Clickresume (java line: 23594)
java.lang.UnsupportedOperationException
at java.util.AbstractList.remove(AbstractList.java:161)
at anywheresoftware.b4a.objects.collections.List.RemoveAt(List.java:104)
at www.sagitalcashlite.net.menu$ResumableSub_phoneout_Click.resume(menu.java:23594)
at anywheresoftware.b4a.BA.checkAndRunWaitForEvent(BA.java:240)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:180)
at anywheresoftware.b4a.BA$2.run(BA.java:360)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6938)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
any idea what is wrong?
i also need to mention that some files are written in hebrew, could that be the reason?
thanx, ilan