Android Question how create spinner with more than one column

Makumbi

Well-Known Member
Licensed User
B4X:
[{"Years":2009,"Term":"I"},{"Years":2009,"Term":"II"}]

B4X:
how can i modify this spinner 
which has a table years with columns Years,Term

currently i have this one which shows only one column
Sub InitSpinners
    Private i As Int
    Private Query1 As String
    Private Curs As Cursor
    
    Query1 = "SELECT DISTINCT Years FROM Years ORDER BY Years ASC"
    Curs = Starter.SQL1.ExecQuery(Query1)
    'we add 'no filter' as no selection
    spnFirstName.Clear
    spnFirstName.Add("Select from the List...")
    
    'we fill the Spinner with the data from the database
    For i = 0 To Curs.RowCount - 1
        Curs.Position = i
        'spnFirstName.Add(Curs.GetString("Account"))
        spnFirstName.Add(Curs.GetString("Years"))
        
        'Dim kk As String = Curs.GetString("Names")
        'Log(kk)
    Next
    'spnFirstName.RemoveAt("Select from the List...")
    Curs.Close
    
End Sub
 

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

udg

Expert
Licensed User
Longtime User
may be in future they should think a bout that feature because it is very useful in some instances
I'm surely missing your point.
How would you design such an object? A two-headed one? Picking from first list gives you values for second one? I can't imagine what you have in mind.

If what you need is simply:
2009 - I
2009 - II
just combine those values for the label showing in the traditional spinner and save whatever reference you need in the TAG property.
 
Last edited:
Upvote 0
Top