Android Question cxustomlistview conflict XUI Views?

kisoft

Well-Known Member
Licensed User
HI
I am using this example of building a list successfully.
https://www.b4x.com/android/forum/t...listview-cross-platform-customlistview.84501/.
When I want to add a dialog from this example to the project, I get an error.
https://www.b4x.com/android/forum/threads/b4x-input-dialogs-with-xui-views.101197/

B4X:
** Activity (main) Pause, UserClosed = false **
** Activity (przekazniki) Create, isFirst = true **
Class not found: domo.ster.customlistview, trying: domo.ster2.customlistview
Error occurred on line: 47 (przekazniki)
java.lang.RuntimeException: java.lang.RuntimeException: Field clv was declared with the wrong type.
    at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:170)
    at anywheresoftware.b4a.objects.ActivityWrapper.LoadLayout(ActivityWrapper.java:209)
    at domo.ster2.przekazniki._activity_create(przekazniki.java:475)
    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 domo.ster2.przekazniki.afterFirstLayout(przekazniki.java:104)
    at domo.ster2.przekazniki.access$000(przekazniki.java:17)
    at domo.ster2.przekazniki$WaitForLayout.run(przekazniki.java:82)
    at android.os.Handler.handleCallback(Handler.java:789)
    at android.os.Handler.dispatchMessage(Handler.java:98)
    at android.os.Looper.loop(Looper.java:164)
    at android.app.ActivityThread.main(ActivityThread.java:6710)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:770)
Caused by: java.lang.RuntimeException: Field clv was declared with the wrong type.
    at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayoutHelper(LayoutBuilder.java:431)
    at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayoutHelper(LayoutBuilder.java:454)
 

kisoft

Well-Known Member
Licensed User
OK
I removed the clv module. Now I'm working with xCustolistview library. I get the same error. I must admit that I am a bit confused. This code works well with the customlistview module.
B4X:
    Type DBResult (Tag As Object, Columns As Map, Rows As List)
    Type DBCommand (Name As String, Parameters() As Object)
    Private const rdcLink As String = "http://185.243.53.6:17178/rdc"
    Dim a As Int
    
    Private xui As XUI
    Dim nazwa As List
    Type itmvalue(Label1 As Label, SwitchButton1 As SwitchButton, ia As String)
    Public wsk As Int
    Private Label1 As B4XView
    Private ImageView1 As ImageView
    Private Clv As CustomListView
    Private SwitchButton1 As SwitchButton
    Public a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20 As String
    a1="dom400a.png"
    a2="terarium.png"
    a3="wyj.png"
    a4="wyjscie.png"
    a5="roleta.png"
    a6="piecco.png"
    a7="zaruwka.png"
    a8="piecco.png"
   Private ImageView2 As ImageView
 End Sub

Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("cust")
    Starter.working = True
    nazwa.Initialize
'    dialog.Initialize(Activity)
'    dialog.Title = "Input Dialog Example"

    For i=0 To 23
        CallSub2(Starter,"ShowEntry",i)
         nazwa.Add(Starter.nazwa1a)
    Next
    
    Dim image As List
    image.Initialize
    For Each f As String In Array(a1,a2,a3,a4,a5,a6,a7,a8)
    image.Add(LoadBitmapResize(File.dirassets,f,100dip,100dip, True))
    Next
    For i = 0 To 23
        Dim iv As itmvalue
        iv.Initialize
'        Clv.Add(itmval(image.Get( i Mod image.Size),iv),iv)
        Clv.Add(itmval(image.Get(i Mod image.Size),(nazwa.Get(i Mod nazwa.Size)),iv),iv)' działanie z listą nazwa
    Next
    statuspk   
    
    Activity.AddMenuItem("ustawienia","open1")
    Activity.AddMenuItem("Ustawienia globalne","open2")
End Sub
 
Upvote 0

jimmyF

Active Member
Licensed User
You need to open your layout file, "cust", and delete the CustomListView.
The add the xCustomListView and reconfigure it with the same parameters as your deleted CustomListView.
It's a hassle, I know, but it works. :D
 
Upvote 0
Top