Android Question xCustomListView change order of item

sigster

Active Member
Licensed User
Longtime User
Hi

I have xCustomListView with two label how can I change the order so I don't need to call the database again with ORDER BY
 

mangojack

Expert
Licensed User
Longtime User
I have xCustomListView with two label how can I change the order

2 Labels in each row / item ? ... in the designer maybe.

Only 2 rows / Items , containing a single Label ?


Probably we need to supply more information / code if this is no help.
 
Upvote 0

sigster

Active Member
Licensed User
Longtime User
did search again the forum and run into add to list and then to customlistview
problem is I only add last name to the list from the database

B4X:
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
    Type Person (Name As String, plase As String)
End Sub

Sub Globals
    Public Persons As List
    Public per As Person
End Sub

add database to the list

    Do While Crsr.NextRow   
            per.Name = Crsr.GetString("name")
            per.plase = Crsr.GetString("plase")
            Persons.Add(per)               
    Loop
    
    
Button click I only get one name
    
    Persons.SortType("Name", True)
    For i = 0 To Persons.Size - 1
        'Dim p As Person
        per = Persons.Get(i)
        Log(per.Name)
    Next
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
Button click I only get one name
Try this:
B4X:
   Do While Crsr.NextRow
        Dim per As Person
        per.Name = Crsr.GetString("name")
        per.plase = Crsr.GetString("plase")
        Persons.Add(per)
    Loop
   
    Persons.SortType("Name", True)
    For i = 0 To Persons.Size - 1
        Dim per As Person
        per = Persons.Get(i)
        Log(per.Name)
        Log(per.plase)      
    Next
 
Upvote 0
Top