Android Question B4xTable.SetData error

makis_best

Active Member
Licensed User
Hello all

I try to pass a list to b4xtabe using

B4X:
B4XTable1.SetData(ItemList)
But when I run the application I get the error

Error occurred on line: 588 (B4XTable)
java.lang.ClassCastException: gr.john.generalclass$_itemtype cannot be cast to java.lang.Object[]
at gr.john.b4xtable$ResumableSub_SetData.resume(b4xtable.java:470)
at gr.john.b4xtable._setdata(b4xtable.java:337)
at gr.john.document$ResumableSub_LoadGeneralClassDataList.resume(document.java:945)
at gr.john.document._loadgeneralclassdatalist(document.java:916)
at gr.john.document._activity_resume(document.java:906)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
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 java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:176)
at gr.john.document$ResumeMessage.run(document.java:310)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5376)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:908)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:703)
Why?
What it means?
 
Last edited:

José J. Aguilar

Well-Known Member
Licensed User

makis_best

Active Member
Licensed User
I create the list using this code-->
B4X:
Dim N As ItemType
            N.But = ""
            N.OrderNum = Main.General1.OrderNum
            N.Gid = Main.General1.Client_GID
            N.LineAA = Main.General1.LineAA
            N.Code    = ItemTable_All_Items.GetValue(0,row)
            N.Description = ItemTable_All_Items.GetValue(1,row)
            N.Munit = ItemTable_All_Items.GetValue(2,row)
            N.Price = ItemTable_All_Items.GetValue(3,row)
            N.Quantity = ItemTable_All_Items.GetValue(4,row)
            N.Perc1 = Main.General1.Percent1
            N.Perc2 = Main.General1.Percent2
            N.AxiaProEkptosis = Total1
            N.KathariAxia = KathariAxia
            N.PosostoFPA = Main.General1.VatPercent
            N.AxiaFPA = AxiaFPA
            N.Comment = ""
            ItemList.Add(N)
I can't have type into list?
 
Last edited:

José J. Aguilar

Well-Known Member
Licensed User
Have you tried with an array?

Data is a list. Each item in the list is an array of objects that represents a row.
Example
B4X:
Dim data As List
data.Initialize
data.Add(Array(1, 2, 3))
data.Add(Array(4, 5, 6))
B4XTable1.SetData(data)
 

makis_best

Active Member
Licensed User
Ok....

I understand..... So no point to use type in my code.
I change my code to fit needs of b4xtable.
Thank you.
 

José J. Aguilar

Well-Known Member
Licensed User
What about something like:
B4X:
data.Add(Array(N.OrderNum,N.Gid,N.LineAA, ...))
Remember that there are currently three types: TEXT, NUMBERS and DATES.
 
Top