Android Question SelectedItem Spinner Error

dhernandez

Active Member
Licensed User
Good day to all.
I have a question. How do I go about selecting an item of a Spinner from a variable?

Currently I do this:

B4X:
Dim Valor1 as string
Valor1=Cursor1.Getstring("Col1")
ListaValor.SelectedItem(Valor1)
Generates an error when trying to run it
 

NJDude

Expert
Licensed User
A couple of things:

1- Is the Valor1 variable numeric?
2- What's the error?
 

dhernandez

Active Member
Licensed User
thnks...

1.- Is String
2.-
B4X:
Parsing code.                           0.03
Compiling code.                         Error
Error compiling program.
Error description: Array expected.
Occurred on line: 95
ListaValor.SelectedItem(Variables.EP_VALOR)
Word: (
In that line the error
 

NJDude

Expert
Licensed User
The syntax for SelectedItem is wrong, it's read only, you should be using SelectedIndex
 

dhernandez

Active Member
Licensed User
I need to do it that way, because the value displayed by the Spinner, always depend on other value in the database.
 
Top