Android Question SOLVED Populate listview from txt file?

Discussion in 'Android Questions' started by G-ShadoW, Jun 28, 2015.

Similar threads

B4A Question (SOLVED) Find line in txt file and replace
B4A Tutorial Text files
B4A Tutorial Android Serial tutorial
B4A Code Snippet How To Use SQRT and POWER in a SQLite Query
B4A Code Snippet Fun With Lists
  1. G-ShadoW

    G-ShadoW Active Member Licensed User

    Hello,
    how to fill ListView ?

    Inside txt file:
    Code:
    MK Lion:15.07.2015:www.example.com
    MK Dog:
    18.07.2015:www.something.com
    etc...
    Code:
    Sub ReadTextFile
       
        
    Dim reader As TextReader       
        reader.Initialize(
    File.OpenInput(FilePath,FileName))
        
    Dim line As String
        line = reader.ReadLine
        
    Do While line <> Null
              MyList.add(line)
              line = reader.ReadLine
        
    Loop               
        reader.Close 
        
    For i=0 To MyList.Size-1
             
    Dim MyLine As String =MyList.Get(i)
            Listview1.AddTwoLines2(MyLine.SubString2(
    0,MyLine.IndexOf(":"),..... ' <------
           
        
    Next
       
    End Sub
     
Loading...