I'm very confused, I can select an item from spinner and display it in a pop up message. I have this,
btnSubmitRequest.Click += (sender, e) =>
{
spinnerJobTypes.ItemSelected += new EventHandler<AdapterView.ItemSelectedEventArgs>(spinnerJobTypes_ItemSelected);
}
private void spinnerJobTypes_ItemSelected(object sender, AdapterView.ItemSelectedEventArgs e)
{
Spinner spinner = (Spinner)sender;
string toast = string.Format("{0}", spinner.GetItemAtPosition(e.Position));
Toast.MakeText(this, toast, ToastLength.Long).Show();
}
How can I get the response from spinnerJobTypes_ItemSelected to a string so that I can submit it into the database?
Any help is greatly appreciated
@Jeff.H is right, but you need the answer in C#. So, you have to do something like this (I tried it):
Spinner spinner = (Spinner)sender;
string selectedItem = spinner.SelectedItem.ToString();
Hope this help you.
You could try something like this
Spinner spinner = (Spinner)findViewById(R.id.spinner);
String text = spinner.getSelectedItem().toString();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With