Android Question B4XSwitch values don't work with B4Av10.0

demonio_jack

Member
Licensed User
Hi everyone:
I've been working with B4Av9.9 till today, now I upgraded to v10.0 and B4XSwitch control doesn't work. I'm referring XUI Views (2.35) library but receive this error message when I try to change the value (True/false)

Error occurred on line: 98 (B4XSwitch)
java.lang.RuntimeException: Cannot parse: as boolean
at anywheresoftware.b4a.BA.parseBoolean(BA.java:629)
at anywheresoftware.b4a.BA.ObjectToBoolean(BA.java:699)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:348)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:197)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:193)
at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:80)
at android.view.View.performClick(View.java:6659)
at android.view.View.performClickInternal(View.java:6631)
at android.view.View.access$3100(View.java:790)
at android.view.View$PerformClick.run(View.java:26187)
at android.os.Handler.handleCallback(Handler.java:907)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:216)
at android.app.ActivityThread.main(ActivityThread.java:7625)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:987)

The problem is until yesterday the control worked perfectly, and with the new version crashed.

If mycur.getstring("active")=2 Then
swtRecordarDatos.Value=True
Else
swtRecordarDatos.Value=False
End If

I tested the control in other new project and WORKS!!!! Any idea to "refresh" the references to this library?

Thanks.
 

demonio_jack

Member
Licensed User
Hi Erel:
This is what I get in release mode:

startInputReason = 1
ioctl c0044901 failed with code -1: Invalid argument
uid=10207(b_play.b_quiz) RenderThread identical 1 line
ioctl c0044901 failed with code -1: Invalid argument
surface should not be released
Remove activity client record, r= ActivityRecord{152c6c6 token=android.os.BinderProxy@41a7ee {b_play.b_quiz/b_play.b_quiz.login}} token= android.os.BinderProxy@41a7ee
playSoundEffect effectType: 0
querySoundEffectsEnabled...
asyncReportData b_play.b_quiz,2,1,1,0 interval=118
(RuntimeException) java.lang.RuntimeException: Cannot parse: as boolean
jank_removeInvalidNode jank list is null
ok

Thanks
 
Upvote 0

demonio_jack

Member
Licensed User
The error is caught in a Catch block. Comment it so it will show the full stack trace.

Erel:
I found a solution but I'm sure why happens:

this is the original code:
B4X:
...
q="Select * from users where lastone=1"
mycur=localDB.ExecQuery2(q,Null)
If mycur.RowCount> 0 Then
   mycur.Position=0
   If mycur.getstring("active")=2 Then
      swtRecordarDatos.Value=True
   Else
      swtRecordarDatos.Value=False
   End If
End if

the problem is when I try to set the 'value' property for B4XSwitch,.... but if define a local variable and a set de value and then ask for it... bingo.!!!
B4X:
...
q="Select * from users where lastone=1"
mycur=localDB.ExecQuery2(q,Null)
If mycur.RowCount> 0 Then 
   mycur.position=0
   dim last_state as int
   last_state=mycur.getstring("active")

   If last_state=2 Then
      swtRecordarDatos.Value=True
   Else
      swtRecordarDatos.Value=False
   End If
End if

Any idea why happens this bug? (remember the code with v9.90 was working perflectly)

thanks.
 
Last edited:
Upvote 0
Top