Android Question Issue updating to newer version of FlexibleTable Class

stu14t

Active Member
Licensed User
Longtime User
I'm blowing the dust off an old app and updating from version 1.33 to version 3.09 of the table class.

I've now added the Table in the designer, instead of through code and modified my code but I get an error as follows:
logs:
--------- beginning of main
Copying updated assets files (43)
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Error occurred on line: 498 (Table)
java.lang.RuntimeException: Object should first be initialized (Panel).
    at anywheresoftware.b4a.AbsObjectWrapper.getObject(AbsObjectWrapper.java:50)
    at anywheresoftware.b4a.objects.ViewWrapper.setTag(ViewWrapper.java:255)
    at com.dcpdata.exp.table._inittable(table.java:1149)
    at com.dcpdata.exp.table._initialize(table.java:3518)
    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.raiseEvent2(BA.java:180)
    at anywheresoftware.b4a.objects.CustomViewWrapper.AfterDesignerScript(CustomViewWrapper.java:61)
    at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:162)
    at anywheresoftware.b4a.objects.PanelWrapper.LoadLayout(PanelWrapper.java:134)
    at anywheresoftware.b4a.objects.TabStripViewPager.LoadLayout(TabStripViewPager.java:116)
    at com.dcpdata.exp.main._activity_create(main.java:579)
    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 com.dcpdata.exp.main.afterFirstLayout(main.java:104)
    at com.dcpdata.exp.main.access$000(main.java:17)
    at com.dcpdata.exp.main$WaitForLayout.run(main.java:82)
    at android.os.Handler.handleCallback(Handler.java:883)
    at android.os.Handler.dispatchMessage(Handler.java:100)
    at android.os.Looper.loop(Looper.java:237)
    at android.app.ActivityThread.main(ActivityThread.java:7811)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1076)
Current page: 0
** Activity (main) Resume **

This was the code I used for Version 1.33 and this still works with V1.33:

Old V1.33 code:
Table1.Initialize (Me, "Table1", 3, Gravity.CENTER, False)
Table1.AddToActivity(PanelTab, 0dip, 0dip, 150dip, 380dip)
Table1.HeaderColor = Colors.LightGray
Table1.HeaderTextColor = Colors.Black
Table1.TextSize = 12
Table1.SetHeader(Array As String("Blows", "Total blows", "Pen"))
Table1.SetColumnsWidths (Array As Int (50dip, 50dip, 50dip))

And this is the modified code for V3.09 (with Table added in designer)
New code V3.09:
Table1.SetColumnsWidths(Array As Int(50dip, 50dip, 50dip))
Table1.SetHeader(Array As String("Blows", "Total blows", "Pen"))

What have I missed out in either correctly implementing or initializing?
 
Last edited:

stu14t

Active Member
Licensed User
Longtime User
Many thanks for the response Klaus,

I've attached a cut down version of my project and it still behaves the same, with the same error, as the original app.

Please ignore all the unused variables etc
 

Attachments

  • Test1.zip
    258.9 KB · Views: 193
Upvote 0

klaus

Expert
Licensed User
Longtime User
How did you zip your project? You should use Export As Zip in the File menu.
There are layout files missing.
I commented the lines.

What exactly do you want to do?
Why did you modify this routine in the class?

B4X:
Public Sub Initialize (CallBack As Object, EventName As String)
    cEventName = EventName
    cCallBack = CallBack
    
    cSortBitmapWidth = 10dip
    cSortBitmapColor = Colors.Yellow
    InitTable
End Sub
Why did you add InitTable, this is wrong!
Please explain what you want to do.
How do you want to fill the Table.
Did you change other things in the class?

Added a small test project.
 

Attachments

  • TestNewTable.zip
    30.6 KB · Views: 202
Upvote 0
Top