Hello, I'm currently having issue using Customlistview. I'm still studying how it works.
I'd like to add pictures thumbnails to a customlistview but I'am having error when adding them at line 28.
This is the log:
B4J Version: 9.80
Parsing code. (0.10s)
Java Version: 8
Building folders structure. (0.05s)
Compiling code. (0.20s)
Compiling layouts code. (0.00s)
Organizing libraries. (0.00s)
Compiling generated Java code. Error
B4J line: 28
clv.Add(CreateItem(images.Get(i Mod images.Size)
javac 1.8.0_172
src\b4j\example\main.java:120: error: method _add in class customlistview cannot be applied to given types;
_clv._add(_createitem((anywheresoftware.b4a.objects.B4XViewWrapper.B4XBitmapWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.B4XViewWrapper.B4XBitmapWrapper(), (javafx.scene.image.Image)(_images.Get((int) (_i%_images.getSize())))),_txt),(Object)(_txt));
^
required: customlistview,B4XViewWrapper,Object
found: B4XViewWrapper,Object
reason: actual and formal argument lists differ in length
I'd like to add pictures thumbnails to a customlistview but I'am having error when adding them at line 28.
This is the log:
B4J Version: 9.80
Parsing code. (0.10s)
Java Version: 8
Building folders structure. (0.05s)
Compiling code. (0.20s)
Compiling layouts code. (0.00s)
Organizing libraries. (0.00s)
Compiling generated Java code. Error
B4J line: 28
clv.Add(CreateItem(images.Get(i Mod images.Size)
javac 1.8.0_172
src\b4j\example\main.java:120: error: method _add in class customlistview cannot be applied to given types;
_clv._add(_createitem((anywheresoftware.b4a.objects.B4XViewWrapper.B4XBitmapWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.B4XViewWrapper.B4XBitmapWrapper(), (javafx.scene.image.Image)(_images.Get((int) (_i%_images.getSize())))),_txt),(Object)(_txt));
^
required: customlistview,B4XViewWrapper,Object
found: B4XViewWrapper,Object
reason: actual and formal argument lists differ in length
B4X:
#Region Project Attributes
#MainFormWidth: 600
#MainFormHeight: 600
#End Region
Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Private xui As XUI
Private clv As CustomListView
Private ImageView1 As ImageView
Private Label1 As B4XView
Private txt As String
End Sub
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
MainForm.RootPane.LoadLayout("MainPage")
MainForm.Show
Dim images As List
images.Initialize
For Each f As String In Array("1.png","2.png","3.png","4.png")
images.Add(xui.LoadBitmapResize(File.DirAssets,f,100dip,100dip,True))
Next
txt="Image text"
For i = 1 To 20
clv.Add(CreateItem(images.Get(i Mod images.Size),txt),txt) 'PROBLEM HERE'
Next
End Sub
private Sub CreateItem (img As B4XBitmap, txt1 As String) As B4XView
Dim p As B4XView= xui.CreatePanel("")
p.SetLayoutAnimated(0,0,0,100dip,120dip)
p.LoadLayout("ItemLayout")
ImageView1.SetImage(img)
Label1.Text=txt1
Return p
End Sub