Android Question How to make list view clickable and opens a new activity??

yogmis

New Member
Licensed User
I am using the following code. I am new to basic4android.
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("Layout1")

ListView1.Initialize("ListView1")
For i = 1 To 11
ListView1.AddSingleLine("Item #" & i)
Next
Activity.AddView(ListView1, 0, 0, 100%x, 100%y)
End Sub
 

udg

Expert
Licensed User
Please have a look here.
Anyway
Sub ListView1_ItemClick (Position As Int, Value As Object)
will respond to clicks on list's items.

Erel's tutorial reading will make the whole subject even simpler.
 

mangojack

Well-Known Member
Licensed User
please use [code]insert code here ...[/code] tags when posting code .. that includes you too @udg ..:D
 

udg

Expert
Licensed User
eh eh it was just one line..
anyway, you're right; it's better to always comply with good practices, so..
B4X:
Sub ListView1_ItemClick (Position As Int, Value As Object)
 
Top