Listview events

vukanilod

Member
Licensed User
Longtime User
Hi,
I'm having difficulties creating list view click and long click events.
I want to create simple application with list of items and when you click on item you get new activity StartActivity(Activity2)...but...when I try click and long click, nothing happens. Could it be possible that it is not working cause I placed it on tab host?
Thanks:sign0085:
 
Last edited:

vukanilod

Member
Licensed User
Longtime User
Klaus, thanks for your advice, I'm new to all this but let's try again.
I've created a list and placed it on a tab host:
ListView1.Initialize("Activity_Create")
ListView1.RemoveView()
TabHost1.AddTab2("List of Articles", ListView1)
I also added some items...
Then I created click event:
Sub ListView_ItemClick (Position As Int, Value As Object)
Activity.Title=value
End Sub

...and nothing happens?
 

bluejay

Active Member
Licensed User
Longtime User
ListView1.Initialize("Activity_Create")

says the event is called 'Activity_Create' so when an event is triggered
it is looking for the following subroutine

Sub Activity_Create_ItemClick (Position As Int, Value As Object)

Bluejay
 

klaus

Expert
Licensed User
Longtime User
You should remove this line.
ListView1.RemoveView()

in ListView1.Initialize("Activity_Create")
Activity_Create is the EventName for the ListView1 object.
So the Click event routine must look like this:
Sub Activity_Create_Click

Or you could use ListView1.Initialize("ListView1") and
Sub ListView1_Click

It would be easier if you post your project as a zip file (IDE menu Files/Export As Zip), that way we see exactly what you have done and how, test and reproduce your problem in the same conditions as you.

Is your ListView added in the Designer or by code ?
The answer to this question we would have known it directly if we had your whole project.

Best regards.
 
Top