listview, bal file

Avon

Member
Licensed User
Longtime User
Is it possible to create a listview without using a .bal file?

If so, where could I find an example, please?
 

Mahares

Expert
Licensed User
Longtime User
You can do it with code. Here is a simple example to help you out:
B4X:
'Activity module
Sub Process_Globals
   'These global variables will be declared once when the application starts.
   'These variables can be accessed from all modules.

End Sub

Sub Globals
   'These global variables will be redeclared each time the activity is created.
   'These variables can only be accessed from this module.
      Dim MyLV As ListView
End Sub

Sub Activity_Create(FirstTime As Boolean)
     MyLV.Initialize("MyLV")
      Activity.AddView(MyLV,0,0,100%x,75%y)
      For i=0 To 19 
         MyLV.AddSingleLine2("Avon" & i,i)
      Next
End Sub

Sub Activity_Resume
End Sub

Sub Activity_Pause (UserClosed As Boolean)
End Sub

Sub MyLV_ItemClick (Position As Int, Value As Object)
   Msgbox("I chose item: " & Value,"Selected Item")
End Sub
 
Upvote 0
Top