In the CustomListView class duplicate the Panel_Click Sub .. and change event name & parameter strings.
B4X:
Private Sub Panel_LongClick
If SubExists(CallBack, EventName & "_LongClick") Then
Dim v As View
v = Sender
CallSub3(CallBack, EventName & "_LongClick", v.Tag, items.Get(v.Tag))
End If
End Sub
Hi
I did the above, and once I press long click I am getting:
java.lang.Exception: Sub clv3_longclick signature does not match expected signature.
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:177)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:163)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:159)
at anywheresoftware.b4a.objects.ViewWrapper$2.onLongClick(ViewWrapper.java:87)
at android.view.View.performLongClick(View.java:4268)
at android.widget.TextView.performLongClick(TextView.java:8309)
at android.view.View$CheckForLongPress.run(View.java:17277)
at android.os.Handler.handleCallback(Handler.java:615)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4921)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1027)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794)
at dalvik.system.NativeStart.main(Native Method)
java.lang.Exception: Sub clv3_longclick signature does not match expected signature.
Private Sub Panel_LongClick
If SubExists(CallBack, EventName & "_LongClick") Then
Dim v As View
v = Sender
CallSub3(CallBack, EventName & "_LongClick", v.Tag, items.Get(v.Tag))
End If
End Sub
But now - this is strange: I put the same code on "CustomListView" example project and it is working fine
How can it be?
Don't confuse the panel LongClick event that you add inside CustomListView class (with no parameters) to the one that is outside the class with the two parameters.
This is in the class: (as written in the example above)
B4X:
Private Sub Panel_LongClick
If SubExists(CallBack, EventName & "_LongClick") Then
Dim v As View
v = Sender
CallSub3(CallBack, EventName & "_LongClick", v.Tag, items.Get(v.Tag))
End If
End Sub
and this is in my activity:
B4X:
Sub clv3_LongClick (Index As Int,Value As Object)
Log("OK")
End Sub
Ok, I found the issue
I had label which is init as: Label1.Initialize("clv3")
(I did this since I used other listView and I wanted to have same trigger as clv3)
so once I changed the name of the above label, now it is ok
strange thing that ItemClick had no issue, only the LongClick
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.