Android Code Snippet xCustomListView Loading Tip

Discussion in 'Code Snippets' started by Harris, Feb 24, 2019.

  1. Harris

    Harris Well-Known Member Licensed User

    When loading a large CLV list (items derived from a ResultSet - for example), I find it loads much faster if you set the underlying scroll view visibility to False (before loading the list). Set it back to True after populating the the custom list, as follows:

    Code:
    ProgressDialogShow2("Updating All Posts...",False)  ' show user the list is being created...   

    Cursor = Starter.SQL1.ExecQuery(qry) ' get a subset of the list to load

    clvunits.Clear   
    ' empty the existing xCLV (if any)

    ' set the underlying xCLV scroll view visibility to false - IMPORTANT - don't waste cycles painting the screen!

    clvunits.sv.Visible = 
    False  ' prevent list update (visibility) from consuming extra time in loop processes

    Do While Cursor.NextRow
        
    ' Load many different layouts (possibly)
        ' Set attributes of the layout loaded
        ' call many other methods to set these attributes
        ' do whatever....
    Loop

    ProgressDialogHide ' dismiss the spinning circle and carry on...

    ' set the underlying xCLV scroll view visibility to True  - also IMPORTANT
    clvunits.sv.Visible = True
    Seems that even thou the list being loaded is not within the current screen view, it is still consuming clock cycles - effectively slowing down loading the list.

    Hey, I could be wrong, I was once before - once...
     
    Last edited: Feb 24, 2019
    prajinpraveen and jimmyF like this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice