I have an app create in B4i and works without error
I am trying to move to B4a but I have this error :
Logger connected to: motorola moto g power 5G - 2023
--------- beginning of main
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create (first time) **
Call B4XPages.GetManager.LogEvents = True to enable logging B4XPages events.
** Activity (main) Resume **
*** Receiver (httputils2service) Receive (first time) ***
Error occurred on line: 36 (PreoptimizedCLV)
java.lang.RuntimeException: Object should first be initialized (JavaObject).
at anywheresoftware.b4a.AbsObjectWrapper.getObject(AbsObjectWrapper.java:67)
at anywheresoftware.b4j.object.JavaObject.getCurrentClass(JavaObject.java:259)
at anywheresoftware.b4j.object.JavaObject.RunMethod(JavaObject.java:119)
at com.hightechstream.kantutacreator.preoptimizedclv._initialize(preoptimizedclv.java:211)
at com.hightechstream.kantutacreator.b4xlistrequests._showlistvideos(b4xlistrequests.java:825)
at com.hightechstream.kantutacreator.b4xlistrequests$ResumableSub_loadListVideosFromServer.resume(b4xlistrequests.java:208)
at anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub.resumeAsUserSub(DebugResumableSub.java:48)
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:157)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:201)
at anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub.resume(DebugResumableSub.java:43)
at anywheresoftware.b4a.BA.checkAndRunWaitForEvent(BA.java:275)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:150)
at anywheresoftware.b4a.BA$2.run(BA.java:395)
at android.os.Handler.handleCallback(Handler.java:984)
at android.os.Handler.dispatchMessage(Handler.java:104)
at android.os.Looper.loopOnce(Looper.java:238)
at android.os.Looper.loop(Looper.java:357)
at android.app.ActivityThread.main(ActivityThread.java:8088)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:957)
what should do to fix it, the original code is copied by an example on the post:
www.b4x.com
any help would be greatly appreciated
B4X:
Sub Class_Globals
Private Root As B4XView 'ignore
Private xui As XUI 'ignore
Private clvListVideos As CustomListView '<------ variable declared, but not initialized anywere, by the example code
Private PCLV As PreoptimizedCLV
Private MediaManager As SimpleMediaManager
'Type MyVideoData (title As String,descriptionVideo As String,filename As String)
End Sub
Sub showListVideos
MediaManager.Initialize
PCLV.Initialize(Me, "PCLV", clvListVideos) '<----- error detected on this part
For i = 0 To listVideos.Size-1
PCLV.AddItem(350dip, xui.Color_White, listVideos.Get(i))
Log(listVideos.Get(i))
Next
PCLV.ShowScrollBar = False 'no fast scrolling
'PCLV.ExtraItems = 3
PCLV.Commit
End Sub
I am trying to move to B4a but I have this error :
Logger connected to: motorola moto g power 5G - 2023
--------- beginning of main
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create (first time) **
Call B4XPages.GetManager.LogEvents = True to enable logging B4XPages events.
** Activity (main) Resume **
*** Receiver (httputils2service) Receive (first time) ***
Error occurred on line: 36 (PreoptimizedCLV)
java.lang.RuntimeException: Object should first be initialized (JavaObject).
at anywheresoftware.b4a.AbsObjectWrapper.getObject(AbsObjectWrapper.java:67)
at anywheresoftware.b4j.object.JavaObject.getCurrentClass(JavaObject.java:259)
at anywheresoftware.b4j.object.JavaObject.RunMethod(JavaObject.java:119)
at com.hightechstream.kantutacreator.preoptimizedclv._initialize(preoptimizedclv.java:211)
at com.hightechstream.kantutacreator.b4xlistrequests._showlistvideos(b4xlistrequests.java:825)
at com.hightechstream.kantutacreator.b4xlistrequests$ResumableSub_loadListVideosFromServer.resume(b4xlistrequests.java:208)
at anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub.resumeAsUserSub(DebugResumableSub.java:48)
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:157)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:201)
at anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub.resume(DebugResumableSub.java:43)
at anywheresoftware.b4a.BA.checkAndRunWaitForEvent(BA.java:275)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:150)
at anywheresoftware.b4a.BA$2.run(BA.java:395)
at android.os.Handler.handleCallback(Handler.java:984)
at android.os.Handler.dispatchMessage(Handler.java:104)
at android.os.Looper.loopOnce(Looper.java:238)
at android.os.Looper.loop(Looper.java:357)
at android.app.ActivityThread.main(ActivityThread.java:8088)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:957)
what should do to fix it, the original code is copied by an example on the post:
[B4X] [XUI] CustomListView - lazy loading / virtualization
xCustomListView v1.50 adds an important new event named VisibleRangeChanged. This event is fired whenever the visible range of items changes. We can use this event to defer the items creation. This can significantly improve the performance of lists with complex items. As an example, if we try...
any help would be greatly appreciated
Last edited: