Android Question SearchTemplate Custom list add With cs builder

astronald

Active Member
Licensed User
Longtime User
Hello every one,

I try show Search template dialog with flags and text t show country list selection.

if fill list with cs this show this code

fill csbuilder:
list.add(cs.Initialize.Image(LoadBitmap(File.DirAssets,cPais.ToLowerCase & ".png"),32dip,24dip,False).Append("  " & Paises.Get(cPais)& " " & Nombre).PopAll)

con cs.png


well i try fill list with this code

CustomlistView1.add:
opPaises.CustomListView1.AddTextItem( cs.Initialize.Image(LoadBitmap(File.DirAssets,cPais.ToLowerCase & ".png"),32dip,24dip,False).Append("  " & Paises.Get(cPais)& " " & Nombre).PopAll,cPais)
i can see flags
but this crash in this line

antes.png


This is crash:

Crash:
CO
Error occurred on line: 72 (B4XSearchTemplate)
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
    at java.util.ArrayList.get(ArrayList.java:437)
    at anywheresoftware.b4a.objects.collections.List.Get(List.java:117)
    at b4a.example3.customlistview._getrawlistitem(customlistview.java:447)
    at b4a.example3.customlistview._finditemoffset(customlistview.java:376)
    at b4a.example3.customlistview._jumptoitem(customlistview.java:728)
    at com.pokerlap.admin.b4xsearchtemplate$ResumableSub_Show.resume(b4xsearchtemplate.java:324)
    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:144)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:193)
    at anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub.resume(DebugResumableSub.java:43)
    at anywheresoftware.b4a.keywords.Common$13.run(Common.java:1714)
    at android.os.Handler.handleCallback(Handler.java:938)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:246)
    at android.app.ActivityThread.main(ActivityThread.java:8512)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)

Can I modify the CustomlistView1?
Thanks for your help.
 
Solution
Can I modify the CustomlistView1?

Another good option that allows you to have a search box and display text with images is: B4X CLVTree with examples

Also Peter SImpson suite of examples featuring xCustomListView with lazy loading and with Search capabilities is a great source to learn and apply them to real world situations. They helped me learn more about lazy loading.

Mahares

Expert
Licensed User
Longtime User
i can see flags
but this crash in this line
B4XSearchTemplate works with a list of strings and does not support CSBuilder. You can achieve what you are looking for using B4XTable or maybe other ways. See this link for an example showing flags and search feature using B4XTable.
 
Upvote 2

Mahares

Expert
Licensed User
Longtime User
Can I modify the CustomlistView1?

Another good option that allows you to have a search box and display text with images is: B4X CLVTree with examples

Also Peter SImpson suite of examples featuring xCustomListView with lazy loading and with Search capabilities is a great source to learn and apply them to real world situations. They helped me learn more about lazy loading.
 
Upvote 1
Solution
Top