To receive the value of the selected item in Android spinner

Asked 2 years ago, Updated 2 years ago, 88 views

How do I receive the value of the selected item in Android spinner? I want to get the selected text in the spinner when I press the Save button in the dialog, but I don't know how.

android android-spinner

2022-09-22 11:34

1 Answers

Spinner spinner = (Spinner)findViewById(R.id.spinner);
String text = spinner.getSelectedItem().toString();

Do it like this.


2022-09-22 11:34

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.