Android Question Spinner longclick

Dey

Active Member
Licensed User
Longtime User
Hello everybody
i need to add longclick event to a spinner

code:
#Region Shared Files
#CustomBuildAction: folders ready, %WINDIR%\System32\Robocopy.exe,"..\..\Shared Files" "..\Files"
'Ctrl + click to sync files: ide://run?file=%WINDIR%\System32\Robocopy.exe&args=..\..\Shared+Files&args=..\Files&FilesSync=True
#End Region

'Ctrl + click to export as zip: ide://run?File=%B4X%\Zipper.jar&Args=Project.zip

Sub Class_Globals
    Private Root As B4XView
    Private xui As XUI
    Private Spinner1 As Spinner
End Sub

Public Sub Initialize
'    B4XPages.GetManager.LogEvents = True
End Sub

'This event will be called once, before the page becomes visible.
Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    Root.LoadLayout("MainPage")
    
    For n = 1 To 10
        Spinner1.Add(n.As(String))
    Next
    Dim ref1 As Reflector
    ref1.Target = Spinner1
    ref1.SetOnLongClickListener("Spinner1_longclick")
End Sub

'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage.

Private Sub Button1_Click
    xui.MsgboxAsync("Hello world!", "B4X")
End Sub

Private Sub Spinner1_ItemClick (Position As Int, Value As Object)
    
End Sub

Sub Spinner1_longclick        'err java.lang.Exception: Sub spinner1_longclick signature does not match expected signature.
    xui.MsgboxAsync("Spinner longclick", "B4X")
    'Return True
End Sub
'Sub Spinner1_longclick() As Boolean        'err java.lang.Exception: Sub spinner1_longclick signature does not match expected signature.
'    xui.MsgboxAsync("Spinner longclick", "B4X")
'    Return True
'End Sub


i get this error
java.lang.Exception: Sub spinner1_longclick signature does not match expected signature.

Thanks for an answer
 

Attachments

  • LongClickSpinner.zip
    10.2 KB · Views: 164

Chris2

Active Member
Licensed User
Longtime User
I don't really know anything about the Spinner, but would guess the longclick signature should be the same as the itemclick...
B4X:
Sub Spinner1_longclick (Position As Int, Value As Object)
    xui.MsgboxAsync("Spinner longclick", "B4X")
    'Return True
End Sub
 
Upvote 0

Dey

Active Member
Licensed User
Longtime User
I don't really know anything about the Spinner, but would guess the longclick signature should be the same as the itemclick...
B4X:
Sub Spinner1_longclick (Position As Int, Value As Object)
    xui.MsgboxAsync("Spinner longclick", "B4X")
    'Return True
End Sub
modified, same error
 
Upvote 0
Top