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)


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:


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
Cookies are required to use this site. You must accept them to continue using the site. Learn more…