Bug? Extrange behaviour: An error arises when there is no breakpoint

javiito

Member
Licensed User
Longtime User
Hi,
In debug-rapid mode, the following code
B4X:
Dim Image2 As ImageView
Image2=Panel1.GetView(1)
If Bit.AND(Modulo.dispositivos(Dispositivo).Valor, 128)=128 Then
    Image2.Visible=True
Else
    Image2.Visible=False
End If
should enter the "Else" condition (Image2.Visible=False) but the code fails in the second line (Image2=Panel1.GetView(1)) if the code is executed without interruptions.

If i put breakpoint e.g. at the fourth line (Image2.Visible=True) where the execution never enters, the code does not fail.

In release mode it always fail.

The error is:

java.lang.ClassCastException: anywheresoftware.b4a.BALayout cannot be cast to android.widget.ImageView
at domotica.server.main._actualizardispositivo(main.java:2361)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:636)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:305)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:238)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:121)
at anywheresoftware.b4a.BA$3.run(BA.java:332)
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)


Thanks!
 

javiito

Member
Licensed User
Longtime User
Seems like item #2 is a panel, not a label.

Ooops, it is. The funny thing is that the code worked until I removed all breakpoints, so I didn't realise there could be a mistake.

Thanks Erel!
 
Top