i have a type of list that hold records that i will load it into CLV in order
but i got a performance problems because of looping.
the phone lagging and freezing while adding the clv items because i have about 200 items
this code is requested any time with a callsub in tcp client Asyncstreamtext to remove some items from the clv and resort them.
i couldn't found any way to make this sorting better in performance sense every time i need to remove all items from clv and re add them to make the sorting, any help guys for better solution to have the same approach
B4X:
For i = 0 To Persons.Size - 1
Dim usr As Person
usr = Persons.Get(i)
If usr.nameid = unameid Then
Persons.RemoveAt(I)
Exit
End If
Next
Persons.SortType("nameid", True)
If clv.Size > 0 Then
clv.Clear
End If
For i = 0 To Persons.Size - 1
Dim usr As Person
Dim itmheigh As Int
usr = Persons.Get(i)
itmheigh = 38dip
clv.Add(createlistitem(usr.name&usr.nameid, clv.AsView.Width, itmheigh), usr.name&usr.nameid)
'Sleep(0)
Next
but i got a performance problems because of looping.
the phone lagging and freezing while adding the clv items because i have about 200 items
this code is requested any time with a callsub in tcp client Asyncstreamtext to remove some items from the clv and resort them.
i couldn't found any way to make this sorting better in performance sense every time i need to remove all items from clv and re add them to make the sorting, any help guys for better solution to have the same approach