mik21
Member
I have simple activity which has xCustomListView with panel with edit view. Edit has FocusChanged proc. This proc read edit value and set label text in picture edit value is "12" and label text is "Kid 0".
CLV was cleared
Error occurred on line: 84 (CLVActivity)
java.lang.RuntimeException: Object should first be initialized (B4XView).
at anywheresoftware.b4a.AbsObjectWrapper.getObject(AbsObjectWrapper.java:67)
at b4a.example3.customlistview._getitemfromview(customlistview.java:413)
at b4a.example.clvactivity._kidedit_focuschanged(clvactivity.java:504)
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$1.run(BA.java:352)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7562)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)
How to I avoid this crash ?
The "Clear CLV" button clear xCustomListView. If the cursor is parking on the edit view and I click on "Clear CLV" app crash. Debbuger show me that clear clv is run before focus change proc. Crash is on focuschanged proc 2 line "Dim index As Int = CLV1.GetItemFromView(Sender)"FocusChanged:Private Sub kidEdit_FocusChanged (HasFocus As Boolean) If Not (HasFocus) Then 'leave from Edit Dim index As Int = CLV1.GetItemFromView(Sender) Dim record As listBox = CLV1.GetValue(index) Dim krabica As String = record.kidEdit.Text If krabica = "" Then 'pre nezadanu krabicu vymaz label record.kidLabel.Text = "" Else Dim nazovLieku As String = "kid " & index record.kidLabel.Text = nazovLieku Log($"Kid edit record No. ${index} "$) End If End If End Sub
CLV was cleared
Error occurred on line: 84 (CLVActivity)
java.lang.RuntimeException: Object should first be initialized (B4XView).
at anywheresoftware.b4a.AbsObjectWrapper.getObject(AbsObjectWrapper.java:67)
at b4a.example3.customlistview._getitemfromview(customlistview.java:413)
at b4a.example.clvactivity._kidedit_focuschanged(clvactivity.java:504)
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$1.run(BA.java:352)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7562)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)
How to I avoid this crash ?