Android Question [SOLVED] Suddenly the app doesn't load File.DirInternal files

FrankBerra

Active Member
Licensed User
Longtime User
Hi all

I am facing a strange problem

I am developing an app and testing it on 2 differente real devices.
Everything worked perfectly until today when i decided to do some additionals tests and i discovered that the app won't load (some?!) files from internal storage.

B4X:
Error occurred on line: 659 (Main)
java.io.FileNotFoundException: /data/data/prova.app/files/nofotoprofilo.png: open failed: ENOENT (No such file or directory)
    at libcore.io.IoBridge.open(IoBridge.java:416)
    at java.io.FileInputStream.<init>(FileInputStream.java:78)
    at anywheresoftware.b4a.objects.streams.File.OpenInput(File.java:209)
    at anywheresoftware.b4a.objects.drawable.CanvasWrapper$BitmapWrapper.InitializeSample(CanvasWrapper.java:532)
    at anywheresoftware.b4a.keywords.Common.LoadBitmapSample(Common.java:1172)
    at polka.app.main._activity_create(main.java:786)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:702)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:339)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:246)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
    at polka.app.main.afterFirstLayout(main.java:102)
    at polka.app.main.access$000(main.java:17)
    at polka.app.main$WaitForLayout.run(main.java:80)
    at android.os.Handler.handleCallback(Handler.java:615)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:4921)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1027)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794)
    at dalvik.system.NativeStart.main(Native Method)
Caused by: libcore.io.ErrnoException: open failed: ENOENT (No such file or directory)
    at libcore.io.Posix.open(Native Method)
    at libcore.io.BlockGuardOs.open(BlockGuardOs.java:110)
    at libcore.io.IoBridge.open(IoBridge.java:400)
    ... 25 more

The error is raised when i try to load an image from File.DirInternals with the following instruction:
B4X:
Menu_Header_FotoProfilo.Bitmap=LoadBitmapSample(File.DirInternal, "nofotoprofilo.png", Menu_Header_FotoProfilo.Width, Menu_Header_FotoProfilo.Height)

Of course the file is present in the files tab of the project
B4A version: 5.80

I am worried, how to fix this?

Thanks in advance
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…