B4J Question Problem using "ckvs.put" using B4J on raspberry pi (SOLVED)

Alex Oscar Hedman

Member
Licensed User
Hello, im having the next problem when running an UI .jar on a raspberry pi 3.
The problem appears at the end of the sub that im attaching next, when I ask for "ckvs.put".

I dont know if its a problem of the ckvs or the IDE, but i tried everything! ?

This is the problem on the command window:


the code is this one:

B4X:
Sub subcargarasistencia As ResumableSub
    Dim ID As String= LNUM.Get(13)
    Dim sb As StringBuilder
    sb.Initialize
    sb.Append("ASISTENCIA.db")
    If cuantotiene.Length=0 Then cuantotiene=0
    If SQL.IsInitialized Then SQL.Close
    Dim Data() As Byte
    ckvs.RefreshUser ("fitness")
    Data = ckvs.Get("fitness","ASISTENCIA")
    
    Dim DATE As Long=DateTime.NOW
    If Data=Null Then
    Else
        If File.Exists(directorio,sb.ToString)Then File.Delete(directorio,sb.ToString)
        Dim out As OutputStream = File.OpenOutput(directorio,sb, False)
        out.WriteBytes(Data, 0, Data.Length)
        out.Close
    End If
    
    If SQL.IsInitialized Then SQL.Close
    SQL.InitializeSQLite(directorio, sb, True)
    
    Dim m As Map
    m.Initialize
    m.Put("ID", DBUtils.DB_TEXT)
    m.Put("TARJETA", DBUtils.DB_TEXT)
    m.Put("NOMBRE", DBUtils.DB_TEXT)
    m.Put("APELLIDO", DBUtils.DB_TEXT)
    m.Put("FECHA", DBUtils.DB_TEXT)
            
    DBUtils.CreateTable(SQL, "ASISTENCIA", m, Null)
        
    Dim m As Map
    m.Initialize
        
    m.Put("ID", ID)
    m.Put("TARJETA",LNUM.Get(3))
    m.Put("NOMBRE", LNUM.Get(2))
    m.Put("APELLIDO", LNUM.Get(1))
    m.Put("FECHA",DATE)
    
    Dim ListOfMaps As List
    ListOfMaps.Initialize
    ListOfMaps.Add(m)
    DBUtils.InsertMaps(SQL, "ASISTENCIA", ListOfMaps)
            
    cuantotiene=cuantotiene-1
            
    If SQL.IsInitialized Then SQL.Close
    SQL.InitializeSQLite(directorio, sb, True)
    Sleep(500)
        Log("cargo 1er f "&DateTime.time(DateTime.now))
    Try
            Log("BORRANDO")
            Dim sb2 As StringBuilder
            sb2.Initialize
            sb2.Append("DELETE FROM ").Append("DIARIOS").Append(" WHERE "&"ID" &"='"&ID&"'")
            SQL.ExecNonQuery(sb2.ToString)
            
    Catch
        Log(LastException)
    End Try
    Sleep(500)
    
        Log("cargo 2da f "&DateTime.time(DateTime.now))
    If SQL.IsInitialized Then SQL.Close
    SQL.InitializeSQLite(directorio, sb, True)
    
    Dim m As Map
    m.Initialize
    m.Put("ID", DBUtils.DB_TEXT)
    m.Put("TARJETA", DBUtils.DB_TEXT)
    m.Put("NOMBRE", DBUtils.DB_TEXT)
    m.Put("APELLIDO", DBUtils.DB_TEXT)
    m.Put("FECHA", DBUtils.DB_TEXT)
    m.Put("PENDIENTES", DBUtils.DB_TEXT)
            
    DBUtils.CreateTable(SQL, "DIARIOS", m, Null)
        
    Dim m As Map
    m.Initialize
    
    m.Put("ID", ID)
    m.Put("TARJETA",LNUM.Get(3))
    m.Put("NOMBRE", LNUM.Get(2))
    m.Put("APELLIDO", LNUM.Get(1))
    m.Put("FECHA",DATE)
    m.Put("PENDIENTES",cuantotiene)
        
    Dim ListOfMaps As List
    ListOfMaps.Initialize
    ListOfMaps.Add(m)
    DBUtils.InsertMaps(SQL, "DIARIOS", ListOfMaps)
    
    Sleep(500)
    Dim db() As Byte=Bit.InputStreamToBytes(File.OpenInput(directorio,sb.ToString))'lee
    ckvs.Put("fitness","ASISTENCIA",db)
    
        Log("cargo 3ra f "&DateTime.time(DateTime.now))
    Return True
End Sub
 

Alex Oscar Hedman

Member
Licensed User
Hi Erel, thanks for answer

Yes it works on W10 PC properly.
But on raspy in some point of using the software the .jar frozen. I tried different sizes of screen and different jdk's.
I dont know if its something about the JFX or the ckvs
 
Upvote 0

Alex Oscar Hedman

Member
Licensed User
Hey there, it seems that the new version of SQLite worked fine.

But with the only condition that the program must run on start. If you start the soft' on the command window it gets blocked in some point.
For me its not problem bc we need the program running on start.

Thanks for the help!!
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…