Android Question [B4A/B4J] Crash B4XDialog + B4XSearchTemplate + B4XListTemplate + Lazy Loading

Elric

Well-Known Member
Licensed User
Hello everybody!

I'm working to two new B4XDialog template:
1. implementation of lazy loading in B4XListTemplate
2. merge of B4XSearchTemplate + B4XListTemplate + lazy loading - named: B4XSearchListLazyTemplate

The main issue is the 2nd template, the B4XSearchListLazyTemplate, and is present only in B4A but not in B4J (I've not B4i).

When I open it the first time, no problem; at second time I've a crash:
B4X:
Logger connesso a: HUAWEI WAS-LX1A
--------- beginning of system
--------- beginning of main
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create (first time) **
Index time: 368 ms (10000 Items)
PCLV.pnlOverlay.Width - PCLV.B4XSeekBar1.mBase.Left 125
Width: 1080 - PCLV.pnlOverlay.Width: 900
Call B4XPages.GetManager.LogEvents = True to enable logging B4XPages events.
** Activity (main) Resume **
intResult = -3
Cancel
0
1
2
3
4
5
6
7
8
9
10
11
Error occurred on line: 117 (cB4XSearchListLazyTemplate)
java.lang.RuntimeException: Object should first be initialized (View).
Did you forget to call Activity.LoadLayout?
at anywheresoftware.b4a.AbsObjectWrapper.getObject(AbsObjectWrapper.java:67)
at anywheresoftware.b4a.objects.B4XViewWrapper.GetView(B4XViewWrapper.java:335)
at b4a.example3.customlistview._getpanel(customlistview.java:440)
    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:157)
at anywheresoftware.b4a.debug.Debug.delegate(Debug.java:262)
at b4a.example.cb4xsearchlistlazytemplate._update(cb4xsearchlistlazytemplate.java:715)
at b4a.example.cb4xsearchlistlazytemplate$ResumableSub_Show.resume(cb4xsearchlistlazytemplate.java:902)
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.keywords.Common$14.run(Common.java:1801)
at android.os.Handler.handleCallback(Handler.java:808)
at android.os.Handler.dispatchMessage(Handler.java:101)
at android.os.Looper.loop(Looper.java:166)
at android.app.ActivityThread.main(ActivityThread.java:7529)
    at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921)


The error is given by the line “Dim p As B4XView = CustomListView1.GetPanel (s)".

I put a log to understand if there was a particular panel but any attempt the panel is different: sometimes no. 2, sometimes no. 7, this time no. 11 etc.

For the lazy loading I've used PreoptimizedCLV, which has the "only" issue to may not manage the customlistview colors and impacts the selection of customlistview items and the color of the letters when I use search (normally the letters in search are colored red), but compared to crashing it is a smaller problem. I've to work about it.

Anyone may help?

Thanks!

A little project is attached.

Also posted in Italian forum: https://www.b4x.com/android/forum/t...template-b4xlisttemplate-lazy-loading.168768/

PS: is this the right section, isn't it? 🤔
 

Attachments

  • glbB4XSearchListOptTemplate.zip
    95.6 KB · Views: 6

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0
Top