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) {
getSelectedItem() returns null if there is nothing selected on your spinner and calling toString() is making your application crash. Get rid of
final String taglia = spinnerTaglia.getSelectedItem().toString();
and in your onClick do:
if (spinnerTaglia.getSelectedItem() == null) {
return;
}
String taglia = spinnerTaglia.getSelectedItem().toString();
// the other code