Android Question [Solved] - Problem with CustomListView v1.70?

JMB

Active Member
Licensed User
Longtime User
Hi there,

I upgraded to the latest version of CustomListView (v1.70) and I get this error in some code which worked with the previous version -

clv1.Add(CreateItem(Rnd(0xFF000000, 0xFFFFFFFF)
javac 1.8.0_121
src\b4a\example3\main.java:430: error: method _add in class customlistview cannot be applied to given types;
mostCurrent._clv1._add(_createitem(anywheresoftware.b4a.keywords.Common.Rnd((int) (0xff000000),(int) (0xffffffff)),"From Aberdeen EGPD",_id),(Object)(_id));

required: customlistview,B4XViewWrapper,Object
found: B4XViewWrapper,Object
reason: actual and formal argument lists differ in length



This is the code from the Expandable List demo which I had modified a bit as I experimented with it.

B4X:
    For i = 1 To 20
        Dim id As ItemData
        id.Initialize
        id.CollapsedHeight = 80dip
        id.ExpandedHeight = id.CollapsedHeight + Rnd(100dip, 300dip)
        If i = 1 Then
            clv1.Add(CreateItem(Rnd(0xFF000000, 0xFFFFFFFF), "From Aberdeen EGPD", id), id)
        Else
            clv1.Add(CreateItem(Rnd(0xFF000000, 0xFFFFFFFF), "to Sumburgh EGPD", id), id)
        End If
    Next

I guess something changed?

JMB
 

JMB

Active Member
Licensed User
Longtime User
It returns a B4XView...

B4X:
Sub CreateItem(clr As Int, Title As String, id As ItemData) As B4XView
    Dim p As B4XView = xui.CreatePanel("")
    p.SetLayoutAnimated(0, 0, 0, clv1.AsView.Width, id.ExpandedHeight)
    p.LoadLayout("Item")
    p.SetLayoutAnimated(0, 0, 0, p.Width,id.CollapsedHeight)
    lblTitle.Text = Title
    lblTitle.TextSize = 20
    lblTitle.Height = id.CollapsedHeight *.6
    If clv1.Size = 0 Then
        lblInfo.Text = ""
    End If
    lblInfo.Top = id.CollapsedHeight *.6
    lblInfo.Height = id.CollapsedHeight * .3
    pnlTitle.Color = Colors.DarkGray
    lblInfo.Color = Colors.DarkGray
    pnlExpanded.Color = ShadeColor(clr)
    p.Tag = False 'collapsed
    Return p
End Sub

JMB
 
Upvote 0
Top