Android Question Launch spinner on activity.loadlayout

Wien.Mart

Member
Licensed User
Longtime User
Hi All,
I've been looking at the different samples of spinner and they all look good. I just have one question, how can I load layout with a spinner on top, meaning I do not need to click on the field to launch the spinner? Thanks in advance ... Martin
 
If understood your question correctly, then you can call the spinner's _Click sub.
didn't test it though.
 
Upvote 0
Thanks Beja but I got an error on compile saying: java.lang.RuntimeException: java.lang.RuntimeException: Don't call setOnClickListener for an AdapterView. You probably want setOnItemClickListener instead.
 
Upvote 0
Did you create the spinner in the designer? If so this should work. If you created it with code do a search for openspinner.


Code: Copy
Sub Activity_Create(FirstTime As Boolean)
'opens the spinner named sp
OpenSpinner(sp)
End Sub

'no need to change this sub
Sub OpenSpinner(s As Spinner)
  Dim r As Reflector
  r.Target = s
  r.RunMethod("performClick")
End Sub
 
Upvote 0
Back
Top