Android Question Costum List View Show Empty Message

BitsAndBytes

Active Member
Licensed User
I have an activity with a panel. I am using the clv library to create and populate a CostumListView with items . I have initialize the object and everything works fine. My question is how i can edit the clv library module code to show an empty message in the middle of costumlistview in case of the costumlistview is empty?

Thank you! :)
 

DonManfred

Expert
Licensed User
Longtime User
Create a panel in the designer with the layout
Add a panel to the CLV and load the Layout to the panel if you dont have anything to show...
 
Upvote 0

BitsAndBytes

Active Member
Licensed User
If listContacts.Size = 0 Then
CostumListViewContacts.AsView.ad(panelEmptyList, 10%y, Null)
End If

..and that returns "java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first"
 
Upvote 0

udg

Expert
Licensed User
Longtime User
panelEmptyList.removeview before adding it to clv
 
Upvote 0

BitsAndBytes

Active Member
Licensed User
B4X:
Dim label As Label
Dim panel As Panel
panel.Initialize("")
label.Initialize("")
label.Text = "This is an empty list"
panel.LoadLayout("emptyListLayout")
panel.RemoveAllViews()
CostumListViewContacts.AsView.Visible = True      
   If (listContacts.Size = 0) Then
           CostumListViewContacts.Add(panel, 100%y, label)
   End If

Now the error has gone, but i cannot see nothing. The label is invisible :(
 
Upvote 0
Top