Spinner event after select

imgsimonebiliato

Well-Known Member
Licensed User
Longtime User
Hi,
I need to bring up a Msgbox, immediately after I select an item from a spinner. What event should I can use?
 

imgsimonebiliato

Well-Known Member
Licensed User
Longtime User
No.
When I star activity, it goes on error with the load_spinner
 
Upvote 0

imgsimonebiliato

Well-Known Member
Licensed User
Longtime User
No.
When I star activity, it goes on error with the load_spinner

it shows, when I initialize the spinner:
"Don't call setOnClickListener for an adapter view. You probably want setOnItemClickListener instead. Continue?"
 
Upvote 0

Maartensaps

Member
Licensed User
Longtime User
Same problem, trying for days now.

I have the same problem.
I define a spinner in the designer, then on initializing it I get this error:


LastException.java.lang.RuntimeException: Don't call setOnClickListener for an adapter view. You probably want setOnItemClickListener instead.

Have been looking for days in the forum, but no solution.:sign0163:
This is the code

'Activity module
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.

End Sub

Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim spinner1 As Spinner
Dim spinner2 As Spinner
End Sub

Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("Layout1")
Activity.LoadLayout("setup_currency")
spinner1.Initialize("spn1")
spinner2.Initialize("spn2")
spinner1.AddAll(Array As String("Euro", "U$", "Pound", "Boliviano", "Arg peso", "Peru Sol"))

End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub spn1_Click

End Sub

Sub spn2_Click

End Sub
 
Upvote 0

barx

Well-Known Member
Licensed User
Longtime User
If you are adding the spinner in the designer, you do not need to initialize it. Just declare it with the same name as used in the designer.
 
Upvote 0

Maartensaps

Member
Licensed User
Longtime User
Now why did I not think of that.

Thanks guys.
I tried it the other way around ((not loading the designed layout), but I never thought of "no initializing" it.

They say: Not all that wander are lost. But I usually am ;-)
 
Upvote 0

Maartensaps

Member
Licensed User
Longtime User
And the same thing...... but with diferent reasons

I start to hate spinners.

One moment they work, the next they don't
Again: java.lang.RuntimeException: java.lang.RuntimeException: Don't call setOnClickListener for an AdapterView. You probably want setOnItemClickListener instead

It does not matter what I do. Add the spinner in the designer, or manually
Initialize it, or not.
The moment the layout is loaded (with the spinner) it creates the error
If I don't use the layout, the same error occurs when I initialize the spinner.

Sub Globals
Dim help_topics As Spinner
Dim label1 As Label
Dim lbl_helptext As Label
Dim spinnerchoice As String
End Sub

Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("help") 'spinner declared in designer
help_topics.AddAll(Array As String("Introduction", "How to convert from... to...", "Change Conversion Buttons", "Currency Update"))
end Sub


I tried banging my head against the wall. Changed my mind and banged the computer to the wall. Then banged the wall against everything else.... but nothing helps.

Of course I know it's me that is doing something wrong, but that makes it even worse.:(

Please help

========
After I changed the name from help_topics to spinner1 (the default name in the designer) the problem disappeared. Any ideas?

=======
And the whole bloody thing starts again the second time I run it. Either shoot me or shoot the spinner
 
Last edited:
Upvote 0

mc73

Well-Known Member
Licensed User
Longtime User
Again. Which event are you using for the spinner? As said earlier, you should use
B4X:
Sub yourSpinner_ItemClick (Position As Int, Value As Object)
Sure this is the case?
 
Upvote 0

Maartensaps

Member
Licensed User
Longtime User
oi oi oi oi.... me so stupid...

Again. Which event are you using for the spinner? As said earlier, you should use
B4X:
Sub yourSpinner_ItemClick (Position As Int, Value As Object)
Sure this is the case?

Don't you just hate it when you make the same mistake twice and never even notice it? (I still used spinner_click)

Thanks! I appreciate your patience.
 
Upvote 0
Top