Android Question How to Retrieve data using Spinner?

Pravee7094

Active Member
Hi all,
I used three Edit Text and one spinner to retrieve the Data. The Edit Text is worked perfectly. But the spinner didn't
I attached the code snippets

B4X:
                    name1  = SelectItem.Get("name")
                    email1 = SelectItem.Get("email")
                    city1 = SelectItem.Get("city")
                    district1 = SelectItem.Get("district")
Here I store the values in strings
[NOTE : name,email,city are edit text field district is spinner field]

Here I retrieve the data

B4X:
If menuItem.Status = "U" Then
        edtName.Text = menuItem.name1
        edtEmail.Text = menuItem.email1
        edtCity.Text = menuItem.city1
        Dim spinnertext As String = Spinner1.SelectedItem
        spinnertext = menuItem.district1
End If

Here all Edit Text Field retrieve the data perfectly. The spinner is did not retrieve the data.
And the "SelectedItem" is read only, so How can I retrieve the data using spinner?

Anybody Help?

Thanks
Praveen
 

Mahares

Expert
Licensed User
Longtime User
Here all Edit Text Field retrieve the data perfectly. The spinner is did not retrieve the data.
Suppose you already populated the spinner with districts, to select a given district, you use the Spinner1_ItemCLick event:
Your code snippets are a little confusing, so this is based on my iffy understanding of what you are trying to do.
B4X:
Private spinnertext As String  'in Globals sub
B4X:
Sub spinner1_ItemClick (Position As Int, Value As Object)
    spinnertext =Value
End Sub
 
Upvote 0
Top