List to Listview

f4u5t

Member
Licensed User
Longtime User
Im sure this is simple but I cant find it, Is there a simple way to load a List into a Listview
 

NJDude

Expert
Licensed User
Longtime User
Assuming your list is called "myList" and you have a listview called ListView1 you can do someting like this:
B4X:
For I = 0 To myList.Size - 1

    ListView1.AddSingleLine(myList.Get(I))
            
Next
 
Upvote 0

f4u5t

Member
Licensed User
Longtime User
Could I please get some help here "LocationViewer" is my listView, that i now have loaded with my list.
"LocationTextInput" is a textedit I want to load with the selection from the listview.

When ever I select some item form the listview the app stops.

B4X:
Sub LocationViewer_ItemClick (Position As Int, Value As Object)
LocationViewer.GetItem(Position)
LocationTextInput.text = LocationViewer.GetItem(Position)
   
End Sub
 
Upvote 0

f4u5t

Member
Licensed User
Longtime User
Thanks, but something else is wrong.
This will not even work.

As soon as I select something I get " unfortunatly MyApp has stopped"

B4X:
Sub LocationViewer_ItemClick (Position As Int, Value As Object)
     Msgbox(LocationViewer.GetItem(Position),"hello")
 
Upvote 0

f4u5t

Member
Licensed User
Longtime User
here it is, It is just one of the database examples im playing with trying to learn a bit.

if you click the button on the top, it will go to a layout with a listview that displays the database files. I want to be able to select one and load it.
Right now if you create a new "location" it works fine, just not the listview

thanks for looking, sorry to be a pain
 

Attachments

  • testDB.zip
    15.4 KB · Views: 237
Upvote 0
Top