Android Question Spinner on Scrollview ItemClick event not working

cwt

Active Member
Licensed User
Longtime User
I have created a ScrollView that has several Spinner views on it. The spinners work fine with being populated and show the selection made but the Spinner_ItemClick event never fires.

The Spinners I have added directly to layouts work fine - ItemClick event fires when item clicked on spinner list but this does not work when the spinner is added via a scrollview.

for testing, the code below is my event capture for the spinner clicked event:
B4X:
Sub MySpinner_ItemClick(Position As Int, Value As Object)
    Msgbox2("MySpinner_ItemClick event fired","","OK","","",Null)
    Dim ID As String
    ID = Value
    MyVariable.Text = MySpinnerMap.Get(ID)
End Sub
What am I missing here?
 
Last edited:

cwt

Active Member
Licensed User
Longtime User
Thanks Erel,

My problem was caused because I did not initialize the Spinner with an event:

I changed MySpinner.Initialize("")

To this:

MySpinner.Initialize("spinner")

and added a tag to the spinner:

MySpinner.Tag = "spinner_1"

Then I was able to trap the event for each individual spinner on the ScrollView.
 
Upvote 0
Top