Android Question How to Re-initialize/Restart ListView?

Discussion in 'Android Questions' started by john1in2, Mar 8, 2018.

Tags:
  1. john1in2

    john1in2 Member Licensed User

    Hi, I am using tabstripviewer from the excellent example.
    Code:
    Private TabStrip1 As TabStrip
        
    Private Page3ListView1 As ListView
        
    Private MasterList As List        'master list of data in file
        Private DisplayList As List        'list in display format
    Using the designer I created Page3 which holds Page3ListView1 as a listview

    Code:
    Activity.LoadLayout("Main")
        TabStrip1.LoadLayout(
    "Page1""HOME")
        
    Dim logo As Bitmap
        logo = 
    LoadBitmap(File.DirAssets, "logo.png")
        Logo1.Bitmap=logo
        TabStrip1.LoadLayout(
    "Page2""SETTNGS")
        TabStrip1.LoadLayout(
    "Page3""VIEW DATA")
        
        
    Activity.AddMenuItem("Jump to HOME""mnu1")
        
    Activity.AddMenuItem("Jump to SETTINGS""mnu2")
        
    Activity.AddMenuItem("Jump to VIEW DATA""mnu3")
    Everything works great,
    Code:
    for i = 1 to intenddata
    Page3ListView1.AddSingleLine(strdata(i))
    next
    Except when the data is updated I want to redo the loop with the new data or over-write the listview with the new data- getting rid of the old data and just showing the most recent data (which includes the old data plus new items)

    What happens in the listview is that I can add things to end but not start over or reinitialize it?
    Code:
    Page3ListView1.Initialize
    Does not seem to do anything.

    How do i re-start the listview as empty?
     
  2. NJDude

    NJDude Expert Licensed User

    To empty/clear a ListView:
    Code:
    Page3ListView1.Clear
     
    DonManfred and lemonisdead like this.
  3. john1in2

    john1in2 Member Licensed User

    Well that's 2 hours I'll never have back- thanks, works great!
     
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