I am getting this error, when click submit button.
Error:
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create (first time) **
Call B4XPages.GetManager.LogEvents = Trueto enable logging B4XPages events.
** Activity (main) Resume **
Submit
1
page2$ResumableSub_getAnswersresume (java line: 149)
java.lang.RuntimeException: Object should first be initialized (B4XView).
at anywheresoftware.b4a.AbsObjectWrapper.getObject(AbsObjectWrapper.java:67)
at b4a.example3.customlistview._getitemfromview(customlistview.java:406)
at exam24.sys.page2$ResumableSub_getAnswers.resume(page2.java:149)
at exam24.sys.page2._getanswers(page2.java:122)
at exam24.sys.page2._b4xpage_menuclick(page2.java:75)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:221)
at anywheresoftware.b4a.BA$1.run(BA.java:360)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:264)
at android.app.ActivityThread.main(ActivityThread.java:7581)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:980)
Private Sub getAnswersDim checkedItems As List
checkedItems.Initialize
'find all checked items.Dim ItemPanel As B4XViewFor i = 0To clv1.Size - 1
ItemPanel = clv1.GetPanel(i)
ForEach xView As B4XViewIn ItemPanel.GetAllViewsRecursive
If xView Is RadioButton ThenIf xView.Checked Then
checkedItems.Add(i)
ExitEndIfEndIfNextNext'Remember that the indices of the CustomListView items start from zero.Log("Checked items: " & checkedItems)
EndSub
The Sender variable contains (always, not only with CustomListViews) a reference to the object that triggered an event; in your case it is the menu item in B4XPage_MenuClick and you don't need it (and Sender "does not exist" in your Sub getAnswers).
["Better" B4XPage_Created of B4XMainPage]
B4X:
Private Sub B4XPage_Created(Root1 As B4XView)
Root = Root1
Root.LoadLayout("MainPage")
B4XPages.SetTitle(Me, "")
examPage.Initialize
B4XPages.AddPage("ExamPage",examPage)
EndSub
[Update your B4A to the last current version, 12.80]
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.