Android Question [SOLVED] B4XTable not working after update to 1.21

makis_best

Active Member
Licensed User
Hi

I was working my project on B4XTable version 1.17 and after updated to 1.21
when I try to run my application I get error on line 148 saying

** Activity (esfiitems) Resume **
true
** Activity (esfiitems) Pause, UserClosed = true **
** Activity (document) Resume **
Error occurred on line: 148 (Document)
java.lang.RuntimeException: Object should first be initialized (View).
at anywheresoftware.b4a.AbsObjectWrapper.getObject(AbsObjectWrapper.java:50)
at anywheresoftware.b4a.objects.B4XViewWrapper.GetView(B4XViewWrapper.java:299)
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.keywords.Common.CallSub4(Common.java:1083)
at anywheresoftware.b4a.keywords.Common.CallSubNew(Common.java:1030)
at gr.iosif.droidview.b4xtable$ResumableSub_ImplUpdateDataFromQuery.resume(b4xtable.java:3243)
at gr.iosif.droidview.b4xtable._implupdatedatafromquery(b4xtable.java:2744)
at gr.iosif.droidview.b4xtable._updatedata(b4xtable.java:2302)
at gr.iosif.droidview.b4xtable._refresh2(b4xtable.java:1078)
at gr.iosif.droidview.b4xtable._refreshnow(b4xtable.java:3589)
at gr.iosif.droidview.b4xtable$ResumableSub_SetData.resume(b4xtable.java:481)
at anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub.resumeAsUserSub(DebugResumableSub.java:48)
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:351)
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.raiseEvent(BA.java:176)
at anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub.resume(DebugResumableSub.java:43)
at anywheresoftware.b4a.BA.checkAndRunWaitForEvent(BA.java:250)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:137)
at anywheresoftware.b4a.BA$2.run(BA.java:370)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6186)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)
The code gives me the error is

B4X:
Public Sub B4XTable1_DataUpdated
    If Main.G1.EditOrder = False  Then
        For i = 0 To B4XTable1.VisibleRowIds.Size - 1
            Dim p As B4XView
            p = G5.editCol.CellsLayouts.Get(i + 1)
            p.GetView(1).Visible = B4XTable1.VisibleRowIds.Get(i) > 0      --->>>    Line 148
            p.GetView(2).Visible = p.GetView(1).Visible
            p.GetView(3).Visible = p.GetView(1).Visible
        Next
    End If
    Dim rs As ResultSet = B4XTable1.sql1.ExecQuery("Select SUM(c12) as SC12, SUM(c14) as SC14 From Data")
    If rs.NextRow Then
        KathariAxiaTxt.Text = NumberFormat2(rs.GetDouble("SC12"), 1, 2, 2, False)
        FPATxt.Text = NumberFormat2(rs.GetDouble("SC14"), 1, 2, 2, False)
        TotalTxt.Text = NumberFormat2(rs.GetDouble("SC12") + rs.GetDouble("SC14"), 1, 2, 2, False)
    End If
    rs.Close
End Sub
Why?

The first column of the table has 3 buttons and I change the type of column as
B4X:
editCol = B4XTable11.AddColumn("Επεξεργασία", B4XTable11.COLUMN_TYPE_VOID)
Also I exclude empty values fields from the Data collection .
 

makis_best

Active Member
Licensed User
Yes I did @Erel

B4X:
        B4XTable11.MaximumRowsPerPage = 8
        B4XTable11.BuildLayoutsCache(B4XTable11.MaximumRowsPerPage)
        Sleep(0)
        For i = 1 To editCol.CellsLayouts.Size - 1
            Dim p As B4XView = editCol.CellsLayouts.Get(i)
            p.AddView(CreateButton("btnEdit", Chr(0xF044)), 2dip, 5dip, 40dip, 40dip)
            p.AddView(CreateButton("btnDelete", Chr(0xF00D)), 44dip, 5dip, 40dip, 40dip)
            p.AddView(CreateButton("btnInfo", ""), 85dip, 5dip, 40dip, 40dip) 'Chr(0xF0C5)
        Next
 

makis_best

Active Member
Licensed User
It is not that simple... We are talking about a very very big project with crm, erp, statistics all combined together and more
 

Mahares

Well Known Member
Licensed User
It is not that simple...
OK Makis, you are the best. If you can isolate the problem and limit it to one table. Sometimes, it is not that simple, but B4XTable library is very reliable so far, but still evolving and there may still be bugs, when solved could help us all. I step aside and leave it to Erel to answer you.
 

makis_best

Active Member
Licensed User
What??? I have a Sleep(0) there?
No need to be there... LOL

You correct @Erel it was a sleep(0) there
but even if I remove it... Same error.... :(

If I comment
B4X:
If Main.G1.EditOrder = False  Then
        For i = 0 To B4XTable1.VisibleRowIds.Size - 1
            Dim p As B4XView
            p = G5.editCol.CellsLayouts.Get(i)
            p.GetView(1).Visible = B4XTable1.VisibleRowIds.Get(i) > 0
            p.GetView(2).Visible = p.GetView(1).Visible
            p.GetView(3).Visible = p.GetView(1).Visible
        Next
    End If
then all my app run fine
 
Last edited:

makis_best

Active Member
Licensed User
I find the solution...
I change the
B4X:
p = G5.editCol.CellsLayouts.Get(i)
to
B4X:
p = G5.editCol.CellsLayouts.Get(i+1)
Cuz the first column of the table where I put the view - buttons is declared as COLUMN_TYPE_VOID
 
Top