I have a Spinner
, and put the selected item in the body of a mail.
this is my code:
@Override
protected void onCreate(Bundle savedInstanceState) {
Move the line
final String taglia = spinnerTaglia.getSelectedItem().toString();
to inside your OnClickListener
Currently, you're trying to read the selected item before anything has been selected. You should also ensure that getSelectedItem()
isn't returning null because, unless you enable / disable the btnCompilaOrdine
button (when an item is selected), the user can press the button without selecting an item in the spinner.