title: Pass data between Activities in onClickListener
body: <p>I want to get a string and send it via the <code>onClickListener</code> method to other activity, I already have the code in another activity where it will be catched, I get it to work by doing this:<br>
  Example: <code>String Culo = lblMensaje.getText().toString;</code></p>
  
  <p>This way I could get the text and send it to another activity, but its not as efficent as sending the original string.. Would it be posible to send it?</p>
  
  <pre><code>final String sexos[] =
                  new String[] {"00311712 Biología I","Mar-Jue 7:00am Prof.Briceño","Elem3","Elem4","Elem5"};
  
        final String[] datos =
                   new String[]{"0031711 Lab Biologia","Lun-Mar 9:30am prof. Marcarian","Elem3","Elem4","Elem5"};
  
  
  
          @Override
          public void onCreate(Bundle savedInstanceState) {
              super.onCreate(savedInstanceState);
              setContentView(R.layout.pipe);
  
              final TextView lblMensaje = (TextView)findViewById(R.id.LblMensaje);
              final Spinner cmbOpciones = (Spinner)findViewById(R.id.CmbOpciones);
  
              final String[] datos =
                      new String[]{"0031711 Lab Biologia","Lun-Mar 9:30am prof. Marcarian","Elem3","Elem4","Elem5"};
  
  
              ArrayAdapter&lt;String&gt; pipe =
                  new ArrayAdapter&lt;String&gt;(this,
                      android.R.layout.simple_spinner_item, datos);
  
  
              pipe.setDropDownViewResource(
                R.layout.multiline_spinner_dropdown_item);
  
  
  
              cmbOpciones.setAdapter(pipe);
  
              cmbOpciones.setOnItemSelectedListener(
               new AdapterView.OnItemSelectedListener() {
                      public void onItemSelected(AdapterView&lt;?&gt; parent,
                          android.view.View v, int position, long id) {
                              lblMensaje.setText("Seleccionado: " + datos[position]);
  
  
  
                      }
  
                      public void onNothingSelected(AdapterView&lt;?&gt; parent) {
                          lblMensaje.setText("");
                      }
  
              });
  
  
              final TextView lblMensaje1 = (TextView)findViewById(R.id.LblMensaje1);
              final Spinner cmbOpciones1 = (Spinner)findViewById(R.id.CmbOpciones1);
  
              final String sexos[] =
                 new String[] {"00311712 Biología I","Mar-Jue 7:00am Prof.Briceño","Elem3","Elem4","Elem5"};
  
           ArrayAdapter&lt;String&gt; adaptador1 =
              new ArrayAdapter&lt;String&gt;(this,
                  android.R.layout.simple_spinner_item, sexos);
  
  
  
          adaptador1.setDropDownViewResource(
                  android.R.layout.simple_spinner_dropdown_item);
  
  
  
          cmbOpciones1.setAdapter(adaptador1);
  
          cmbOpciones1.setOnItemSelectedListener(
           new AdapterView.OnItemSelectedListener() {
                  public void onItemSelected(AdapterView&lt;?&gt; parent,
                      android.view.View v, final int position, long id) {          
                          lblMensaje1.setText(sexos[position]);
  
  
  
  
                  }
  
                  public void onNothingSelected(AdapterView&lt;?&gt; parent) {
                      lblMensaje1.setText("");
                  }
  
  
          });
          Button BotonPasar1;
          BotonPasar1 = (Button)findViewById(R.id.VB1);
           BotonPasar1.setOnClickListener(new View.OnClickListener(){
  
           public void onClick(View v) {
              // TODO Auto-generated method stub
  
  
              String Culo;
  
         Culo = datos[position];
              String Culoq;
              Culoq = sexos[position];
  
  
  
              SharedPreferences mypreferences = getSharedPreferences("myPrefs", Context.MODE_PRIVATE);
              SharedPreferences.Editor editor = mypreferences.edit();
              editor.putString("Culo",Culo);
              editor.commit();
  
  
  
                 SharedPreferences mypreferences1 = getSharedPreferences("myPrefs", Context.MODE_PRIVATE);
                SharedPreferences.Editor editor1 = mypreferences1.edit();
              editor1.putString("Culoq", Culoq);
              editor1.commit();
  
                    String Culo1 = String.valueOf(Culoq + 1);
  
              SharedPreferences mypreferences2 = getSharedPreferences("myPrefs", Context.MODE_PRIVATE);
              SharedPreferences.Editor editor2 = mypreferences2.edit();
              editor2.putString("Culo1",Culo1);
              editor2.commit();
  
           }
  
          });
           Button BotonPasar2;
           BotonPasar2 = (Button)findViewById(R.id.VB2);
            BotonPasar2.setOnClickListener(new View.OnClickListener(){
  
            public void onClick(View v) {
               // TODO Auto-generated method stub
             Intent pasarahorario = new Intent("com.reversiblelabs.unisvenecas.udobeta.HORARIO");                          
            startActivity(pasarahorario);
  
            }
  
           });
  
  
          }
  
      }
  </code></pre>