I have an xCLV with an AutoTextSizeLabel, a series of buttons and a series of CheckBoxes. The data is populated from a small SQLite database table with 200 records.
I select a few items by clicking a number of checkboxes. Then, I click a button below the xCLV that displays all items that were checked in the checkboxes. It returns the following error. However, if I use only 35 records in the SQL statement with LIMIT 35 instead of LIMIT 200, there is no crash. I am including a small project that reproduces the behavior. Thank you.
The relevant button code is:
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:197)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:193)
at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:80)
at android.view.View.performClick(View.java:6300)
at android.view.View$PerformClick.run(View.java:24941)
at android.os.Handler.handleCallback(Handler.java:790)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6523)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:857)
** Activity (main) Pause, UserClosed = true **
** Service (starter) Destroy (ignored)**
I select a few items by clicking a number of checkboxes. Then, I click a button below the xCLV that displays all items that were checked in the checkboxes. It returns the following error. However, if I use only 35 records in the SQL statement with LIMIT 35 instead of LIMIT 200, there is no crash. I am including a small project that reproduces the behavior. Thank you.
The relevant button code is:
B4X:
Sub btn_Click
Dim checkedItems As List
checkedItems.Initialize
For i = 0 To clv2.size - 1
Dim p As B4XView = clv2.GetPanel(i)
Dim chk As B4XView = p.GetView(1) 'this is line 88 crash
If chk.Checked Then
checkedItems.Add(clv2.GetValue(i))
End If
Next
Log($"${checkedItems.Size} Checked items:${checkedItems}"$)
End Sub
B4X:
** Activity (main) Resume **
Error occurred on line: 88 (Main)
java.lang.RuntimeException: Object should first be initialized (View).
at anywheresoftware.b4a.AbsObjectWrapper.getObject(AbsObjectWrapper.java:67)
at anywheresoftware.b4a.objects.B4XViewWrapper.GetView(B4XViewWrapper.java:317)
at b4a.example.main._btn_click(main.java:646)
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.BA.raiseEvent(BA.java:193)
at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:80)
at android.view.View.performClick(View.java:6300)
at android.view.View$PerformClick.run(View.java:24941)
at android.os.Handler.handleCallback(Handler.java:790)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6523)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:857)
** Activity (main) Pause, UserClosed = true **
** Service (starter) Destroy (ignored)**