Error while accessing a folder

JDS

Active Member
Licensed User
Longtime User
When I try multiple times to acces the same folder within a few seconds (by tapping a button) I get the following error:

B4X:
java.io.IOException: /data/data/lmmobile.jds.android/files/LM/Uren is not a folder.
   at anywheresoftware.b4a.objects.streams.File.ListFiles(File.java:154)
   at lmmobile.jds.android.globalservice._jobdone(globalservice.java:821)
   at java.lang.reflect.Method.invokeNative(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:507)
   at anywheresoftware.b4a.BA.raiseEvent2(BA.java:167)
   at anywheresoftware.b4a.keywords.Common$4.run(Common.java:885)
   at android.os.Handler.handleCallback(Handler.java:587)
   at android.os.Handler.dispatchMessage(Handler.java:92)
   at android.os.Looper.loop(Looper.java:150)
   at android.app.ActivityThread.main(ActivityThread.java:4277)
   at java.lang.reflect.Method.invokeNative(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:507)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
   at dalvik.system.NativeStart.main(Native Method)


java.lang.RuntimeException: java.lang.RuntimeException: java.io.IOException: /data/data/lmmobile.jds.android/files/LM/Uren is not a folder.
   at anywheresoftware.b4a.keywords.Common$4.run(Common.java:888)
   at android.os.Handler.handleCallback(Handler.java:587)
   at android.os.Handler.dispatchMessage(Handler.java:92)
   at android.os.Looper.loop(Looper.java:150)
   at android.app.ActivityThread.main(ActivityThread.java:4277)
   at java.lang.reflect.Method.invokeNative(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:507)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
   at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.RuntimeException: java.io.IOException: /data/data/lmmobile.jds.android/files/LM/Uren is not a folder.
   at anywheresoftware.b4a.BA.raiseEvent2(BA.java:193)
   at anywheresoftware.b4a.keywords.Common$4.run(Common.java:885)
   ... 9 more
Caused by: java.io.IOException: /data/data/lmmobile.jds.android/files/LM/Uren is not a folder.
   at anywheresoftware.b4a.objects.streams.File.ListFiles(File.java:154)
   at lmmobile.jds.android.globalservice._jobdone(globalservice.java:821)
   at java.lang.reflect.Method.invokeNative(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:507)
   at anywheresoftware.b4a.BA.raiseEvent2(BA.java:167)
   ... 10 more

The folder is created at the beginning of the program in the Activity_Create of the Main activity:
B4X:
File.MakeDir(File.DirInternal, "LM/Uren")

And is getting accessed with the following:

B4X:
Dim lListU As List: lListU.Initialize
   lListU.Clear
   If lListU.IsInitialized Then
      ListU    = File.ListFiles(Globaal.Map_Uren)

The last line generates the error

For the record, File_Uren is placed in a CodeModule like:
Dim Map_Uren As String : Map_Uren = (File.DirInternal & "/LM/Uren") [/code] Any thoughts?
 

JDS

Active Member
Licensed User
Longtime User
Is there a way to check if a certain directory exists?
The folder gets created at the beginning of the program. Thats why I never check if it actually exist.
 
Upvote 0
Top