title: How to pass data from a Spinner to other activity?
body: <p>I'm working on an application that consists on a shopping cart, where the user selects which pizza and which drink he wants, using a spinner for each selection.
  I have been working for a week on how to send the data selected in the spinner to the next activity and display it on a textview, but I don't know how to do it.</p>
  
  <p>My both spinners are working correctly.</p>
  
  <p>Code for the spinner</p>
  
  <pre><code>    Spinner spinner = findViewById(R.id.spinner1);
      ArrayAdapter&lt;CharSequence&gt; adapter = 
      ArrayAdapter.createFromResource(this,
      R.array.numbers, android.R.layout.simple_spinner_item);      
      adapter.setDropDownViewResource  
      (android.R.layout.simple_spinner_dropdown_item);
      spinner.setAdapter(adapter);
      spinner.setOnItemSelectedListener(this);
  
      Spinner spinner2 = findViewById(R.id.spinner2);
      ArrayAdapter&lt;CharSequence&gt; adapter1 = 
      ArrayAdapter.createFromResource(this,
      R.array.drinks, android.R.layout.simple_spinner_item);
      adapter1.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
      spinner2.setAdapter(adapter1);
      spinner2.setOnItemSelectedListener(this);
  
  
  
      @Override
      public void onItemSelected(AdapterView&lt;?&gt; parent, View view, int 
      position, long l) {
      String text = parent.getItemAtPosition(position).toString();
      Toast.makeText(parent.getContext(), text, Toast.LENGTH_SHORT).show();
      }
  
      @Override
      public void onNothingSelected(AdapterView&lt;?&gt; adapterView) {
  
      }
  </code></pre>
  
  <p>Code for the intent</p>
  
  <pre><code>    Button enviar = findViewById(R.id.enviar);
      enviar.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              Intent resumenPedido = new Intent(MainActivity.this, Resumen.class);
              startActivityForResult(resumenPedido, 1);
          }
      });
  </code></pre>