Where is the information coming from that you are putting in the items of the XCLV? How are you currently inserting the items? See (https://www.b4x.com/android/help/collections.html#list_sorttype) for a clue on how to assign each of your XCLV items to a Type, add that Type to a list and then sort the list by the Type. After your list is sorted, you can add your XCLV items in the sorted order to the XCLV.
Sub CreateListItem(Text As String, Width As Int, Height As Int) As Panel
Dim p As Panel
p.Initialize("")
p.SetLayout(0, 0, Width, Height)
p.LoadLayout("cellitem")
label1.Text = " Name "
labelnumber.Text = "100 "
Return p
End Sub
what i am trying to do is sort based on labelnumber.text value i will look at the link now
ok i am working now with the list but is this sorttype do have compare function ? because some times numbers will be equal and some times smaller than and bigger than other list numbers do sorttype will handle them normally in order ?
here is a brief of what i am doing i dont know if its fine way it works any way but maybe will consume too much memory
B4X:
Sub creatuserpersonlist(Text As String)
Dim parammsgnum() As String = Regex.Split("\~", Text)
Dim usr As Person
usr.name = parammsgnum(0)
usr.num = parammsgnum(1)
Persons.Add(usr)
Persons.SortType("num", True)
xclv.Clear
For i = 0 To Persons.Size - 1
Dim usr As Person
usr = Persons.Get(i)
xclv.Add(Createuserafterclearlist(usr.name, xclv.AsView.Width, 38dip), usr.name)
Sleep(0)
Next
End Sub
so each time person added xclv should cleared and re added for the new sort is that correct way ?