Android Question SortType (FieldName AsString, Ascending AsBoolean)

Killer

Member
Licensed User
Longtime User
hallo,

in the Basic4Android help i find this Example:


15.png
SortType (FieldName AsString, Ascending AsBoolean)

Sorts a list with items of user defined type. The list is sorted based on the specified field.
FieldName - The case-sensitive field name that will be used for sorting. Field must contain numbers or strings.
Ascending - Whether to sort ascending or descending.
Example:

Sub Process_Globals
Type Person(Name As String, Age As Int)
End SubSub

Activity_Create(FirstTime AsBoolean)
Dim Persons As List

Persons.Initialize
For i = 1 To 50 Dim p As Person
p.Name = "Person" & i
p.Age = Rnd(0, 121)
Persons.Add(p)
Next
Persons.SortType("Age", True) For i = 0 To Persons.Size - 1 Dim p As Person
p = Persons.Get(i)
Log(p)NextEnd Sub Next
End Sub

I extended only this code :

For i = 0 To Persons.Size - 1

ListView1.AddSingleLine(Persons.get(i))
Next

Now a have a ListView with Item who looks like this :
[Name = Person40, IsInitialized=false, Age=7]
[Name = Person13, IsInitialized=false, Age=9]
[Name = Person78, IsInitialized=false, Age=12]
.....
What can i do to get a ListView who looks like this :
Person407
Person139
Person7812
.......

A List with Name and Age together without blank and withuot "Name =" and "Age="

thx
 
Top