The following code always returns true. Over and over. The delete runs with no error. I know the file is not there because I deleted it.
Pth = /storage/emulated/0/Android/data/com.ISS.MobileJobLogging/files/Documents
FN = E529674-01.bmp
full sub below
What I am doing - I copy a file from the network (elsewhere), load and display the bitmap in this routine.
If it fails to load it drops into the Catch, I assume it is a bad file and delete it.
I know the file is not there because I deleted it and put in a bad password (testing) so it fails to copy from the network. The same File.Exists(Pth, FN) is running elsewhere and also returning true, that is why it is dropping in to this routine - it thinks the file is there.
When the file IS there LoadBitmap runs fine
What am I missing?
below is the error that drops me in to the Catch:
This is line 2456:
B = LoadBitmap(Pth, FN)
B4X:
If File.Exists(Pth, FN) Then
File.Delete(Pth, FN)
End If
Pth = /storage/emulated/0/Android/data/com.ISS.MobileJobLogging/files/Documents
FN = E529674-01.bmp
full sub below
B4X:
Sub DisplayPartPic(Pth As String, FN As String)
Dim B As Bitmap, I As ImageView2
Try
B = LoadBitmap(Pth, FN)
I.Initialize(B, PicPanl, Colors.LightGray, "1", Activity)
PicPanl.Visible = True
Catch
'Msgbox("Error loading " & FN & CRLF & LastException, "DisplayPartPic") 'remmed 7/19/14 - Uneeded?
If File.Exists(Pth, FN) Then
File.Delete(Pth, FN)
End If
NoPic.Text="There was an error loading " & FN & CRLF & "Click here to view docs."
NoPic.Visible=True
NoPic.Left = PicPanl.Left
NoPic.Top = PicPanl.Top
End Try
End Sub
What I am doing - I copy a file from the network (elsewhere), load and display the bitmap in this routine.
If it fails to load it drops into the Catch, I assume it is a bad file and delete it.
I know the file is not there because I deleted it and put in a bad password (testing) so it fails to copy from the network. The same File.Exists(Pth, FN) is running elsewhere and also returning true, that is why it is dropping in to this routine - it thinks the file is there.
When the file IS there LoadBitmap runs fine
What am I missing?
below is the error that drops me in to the Catch:
B4X:
Error occurred on line: 2456 (Main)
java.lang.RuntimeException: Error loading bitmap.
at anywheresoftware.b4a.objects.drawable.CanvasWrapper$BitmapWrapper.Initialize2(CanvasWrapper.java:538)
at anywheresoftware.b4a.objects.drawable.CanvasWrapper$BitmapWrapper.Initialize(CanvasWrapper.java:516)
at anywheresoftware.b4a.keywords.Common.LoadBitmap(Common.java:1315)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:710)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:339)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:249)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:139)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:166)
at anywheresoftware.b4a.shell.DebugResumableSub$RemoteResumableSub.resume(DebugResumableSub.java:19)
at anywheresoftware.b4a.BA.checkAndRunWaitForEvent(BA.java:240)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:132)
at anywheresoftware.b4a.BA$2.run(BA.java:360)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
B = LoadBitmap(Pth, FN)