Android Question Numbers on Spinner

nima1447

New Member
B4X:
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
    Dim 0,1,2,3,4 As Int
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 i As Int
    Private Label1 As Label
    Private Spinner1 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("a1")
    Spinner1.Add("jhon")
    Spinner1.Add("rose")
    Spinner1.Add("mag")
    Spinner1.Add("lolo")
    Spinner1.Add("pan")


End Sub
Hi I'm a Spinner in an activity under the label well.
Spinner contain jhon, rose, mag, lolo, pan, f well. Jhon selection number 0 By choosing rose 1 By selecting mag 2 And .....
But I do not want this. Jhon want to select, for example, 2 or 5 or 9 Give me.
Or rose with a choice of 3 or 2 or 0 or 5 will give me
And also for other options. Please help me.
Please
 

Attachments

DonManfred

Expert
Licensed User
Create a list with the "results" you want to get

B4X:
Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
    Private Label1 As Label
    Private Spinner1 As Spinner
    Private results As List
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("a1")
    results.initialize
    Spinner1.Add("jhon")
    results.add(9)
    Spinner1.Add("rose")
    results.add(1)
    Spinner1.Add("mag")
    results.add(42)
    Spinner1.Add("lolo")
    results.add(4711)
    Spinner1.Add("pan")
    results.add(99)

End Sub
Sub spinner_ItemClick (Position As Int, Value As Object)
	log(results.get(Position))
End Sub
 
Top