I have a list of strings stored in a KVS. It was written with one program and I am trying to read it with another. The strings are all like "item1", "Item2"...
When I hit the SetData line above it abends with:
Rusty
B4X:
Commands.Contents = kvs.Get(1)
Dim data As List
data.Initialize
For i = 0 To Commands.Contents.ItemName.Size -1
Log(i & " - " & Commands.Contents.ItemName.Get(i))
data.Add(Commands.Contents.ItemName.Get(i))
'note, Commands.Contents.ItemName is a list
'I load the contents into another list only
'because I got frustrated and tried this
'I think it should work with the KVS list...
'BTW, the LOGs show the correct content of the stored list...
Next
B4XTable1.AddColumn("Item", B4XTable1.COLUMN_TYPE_TEXT)
B4XTable1.SetData(data)
When I hit the SetData line above it abends with:
Any insights will be appreciated, including a better wayCopying updated assets files (9)
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Error occurred on line: 571 (B4XTable)
java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Object[]
at b4a.example.b4xtable$ResumableSub_SetData.resume(b4xtable.java:346)
at b4a.example.b4xtable._setdata(b4xtable.java:213)
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 b4a.example.main.afterFirstLayout(main.java:104)
at b4a.example.main.access$000(main.java:17)
at b4a.example.main$WaitForLayout.run(main.java:82)
at android.os.Handler.handleCallback(Handler.java:836)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loop(Looper.java:208)
at android.app.ActivityThread.main(ActivityThread.java:6304)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1063)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:924)
Rusty
Last edited: