Android Question xcustomlistview descending/ascending easy change [SOLVED]

AHilberink

Active Member
Licensed User
Longtime User
Hi,

Is it possible to change the sort of an already loaded xcustomlistview from a-z to z-a or visaversa?

I prefer without rebuilding that's why i am curious if there will be an easy way.

Kind regards,
André
 

davemorris

Active Member
Licensed User
Longtime User
Hi
Not sure I under the relevance of you question it my mind in you want to change the order of the whole list then simply clear and rebuild. However, if you wanted to manipulate the display information and avoid flicking I us the GetPanel() method and adjust the items displayed directly.

For example - I have a App which shows a list of names and associate time to complete a course. This time is updated every second for some and for others it is not adjusted. I found if you rebuild the list every second the flickering was irritating if the list was rebuilt. So I scanned through the list and directly adjusted only the times that had changed using the follow code
Update select times:
    For Each playerRec As clsPlayerListPanelItemRec In playerInfo
        If Not( playerRec.finished) Then ' Select and players still running?
            Dim pntrTime As B4XView = clvPlayerList.GetPanel(index).GetView(1) 'view index #1 is the time item
            pntrTime.Text = modString.CvtTicksToTime(timeNow - playerRec.startTime) ' Preplace with new time     
        End If
        index = index + 1
    Next

Hope that helps

Dave
 
Upvote 0

AHilberink

Active Member
Licensed User
Longtime User
Hi
Not sure I under the relevance of you question it my mind in you want to change the order of the whole list then simply clear and rebuild. However, if you wanted to manipulate the display information and avoid flicking I us the GetPanel() method and adjust the items displayed directly.

For example - I have a App which shows a list of names and associate time to complete a course. This time is updated every second for some and for others it is not adjusted. I found if you rebuild the list every second the flickering was irritating if the list was rebuilt. So I scanned through the list and directly adjusted only the times that had changed using the follow code
Update select times:
    For Each playerRec As clsPlayerListPanelItemRec In playerInfo
        If Not( playerRec.finished) Then ' Select and players still running?
            Dim pntrTime As B4XView = clvPlayerList.GetPanel(index).GetView(1) 'view index #1 is the time item
            pntrTime.Text = modString.CvtTicksToTime(timeNow - playerRec.startTime) ' Preplace with new time    
        End If
        index = index + 1
    Next

Hope that helps

Dave

Thanks for helping, but I think my question was not clearly.

I want my xcustomlistview showing in reverse of it's current viewing.
Will this be possible without loading it again?

Hope this will give you more info.

Kind regards,
André
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
I want my xcustomlistview showing in reverse of it's current viewing.
Will this be possible without loading it again?
xCustomListView is a UI. If you want to see it in reverse, you have to sort the underlying data that makes up the xClv and re;load it, where the data source can be a string, list, map, kvs, SQlite database. If for instance, the source is a SQLite database table, you may want to have the table have an index which helps you with speed. You can also implement xClv Lazy Loading which helps you with speed. If you are thinking otherwise with other ideas, post a small project and explain.
 
Upvote 1
Top