The code's been pretty stable for 3 months... it's something else. It triggers FIRST, the first time the file is ever attempted to be accessed and then good, and then bad... But once there's a record in the database in DirInternal, this never happens again, and I'm not storing anything in the initial setup file that runs on startup, or retrieving that data except until I try to get the first pic from Assets...
Here's the error:
** Activity (main) Pause, UserClosed = false **
** Activity (addedit) Create, isFirst = false **
** Activity (addedit) Resume **
java.io.FileNotFoundException: / / : open failed: ENOENT (No such file or directory)
at libcore.io.IoBridge.open(IoBridge.java:409)
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 com.twodogapps.p2s.addedit._activity_resume(addedit.java:627)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:174)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:158)
at com.twodogapps.p2s.addedit.afterFirstLayout(addedit.java:104)
at com.twodogapps.p2s.addedit.access$100(addedit.java:16)
at com.twodogapps.p2s.addedit$WaitForLayout.run(addedit.java:76)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
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:393)
... 20 more
java.io.FileNotFoundException: / / : open failed: ENOENT (No such file or directory)
** Activity (main) Create, isFirst = true **
Here's the code that I'm sure is causing this the first time that file is accessed:
Sub SetBlankPic
iv.Bitmap = LoadBitmap(File.DirAssets,"blank2.png")
ResizePhoto(File.DirAssets,"blank2.png")
osizeh = iv.Height
osizew = iv.Width
osizet = iv.Top
osizel = iv.Left
TurnOnBlankButtons
iv.Visible = True
End Sub
ResizePhoto is working fine and TurnOnBlankButtons is innocuous. It's that blank2.png it's trying to find. And, I know it's there or the pic wouldn't show up afterwards or in other places in the code... But this one errors, when I say yes to the error, it continues and the buttons that were turned on are there, just NOT that image! And this ONLY happens in the beginning!!!
FYI:
Private iv As ImageView is in Globals and has been stable for months.
Dim osizeh, osizew, osizet, osizel As Int are also in Globals. Another FYI, the error system is reporting those as unused variables that are never assigned a value but clearly are in the code.