Android Question What can i get more object.Initialize("object"&number) data?

Discussion in 'Android Questions' started by 李春雄, Feb 13, 2015.

  1. 李春雄

    李春雄 Member Licensed User

    What can i get more object.Initialize("object"&number) data?

    Code:
    Sub Activity_Create(FirstTime As Boolean)   
        
    Activity.LoadLayout("Layout_Examination_UI")   
        
    Dim examsTitle As Int = 0
        
    For titleQuantity = 0 To 4
            autoSpinner.Initialize(
    "autoSpinnerEvent")
            autoPanels.AddView(autoSpinner,
    540dip,((titleQuantity+1)*100)+10dip,150dip,50dip)
            
    'example
            autoSpinner.Tag="autoSpinnerEvent"&(titleQuantity+1)
            autoSpinner.Add(
    "item 1")
            autoSpinner.Add(
    "item 2")
            autoSpinner.Add(
    "item 3")
            autoSpinner.Add(
    "item 4")
            autoSpinner.TextSize = 
    20
        
    Next   
    End Sub
    error in this
    Code:
    Sub btnQRCode_Click
        
    Dim tmpstr As String
        
    For i = 0 To 4
            
    If "autoSpinnerEvent"&(i+1) = autoSpinner.Tag Then
                tmpstr = autoSpinner.SelectedItem & 
    ":" & tmpstr
            
    End If
        
    Next
        
    Msgbox(tmpstr,"")
    End Sub
    think you everyone!!
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Note that you should add Dim autoSpinner As Spinner in the loop to create new instances.

    Can you post the error message from the logs?
     
  3. 李春雄

    李春雄 Member Licensed User

    the file is my example, i need get Spinner0,Spinner1,Spinner2,Spinner3,Spinner4 SelectedItem,
    thank you Erel.

    Code:
    Sub Globals
        
    Dim autoSpinner As Spinner
        
    Dim titleQuantity As Int = 0
       
        
    Private Button1 As Button
    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")
       
        
    For titleQuantity = 0 To 4
            autoSpinner.Initialize(
    "Spinner"&titleQuantity)
            autoSpinner.Add(
    "test1")
            autoSpinner.Add(
    "test2")
            autoSpinner.Add(
    "test3")
            
    Activity.AddView(autoSpinner,10dip,(titleQuantity*80)+10dip,100dip,60dip)
        
    Next

    End Sub

    Sub Button1_Click
        
    For titleQuantity = 0 To 4
            
    '   "Spinner"&titleQuantity : Spinner0,Spinner1,Spinner2,Spinner3,Spinner4
            Dim autoSpinnerValue As Spinner
            autoSpinnerValue = 
    Sender
            
    Msgbox(autoSpinnerValue.SelectedItem,"")
        
    Next
    End Sub
     
  4. Erel

    Erel Administrator Staff Member Licensed User

  5. 李春雄

    李春雄 Member Licensed User

    THANKS FOR YOUR HELP, THE QUESTION HAS BEEN SOLVED
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice