PDA

Ver la Versión Completa : [ CONSULTA ] Bundle


esi92
12/11/15, 22:01:03
Hola compañeros! A ver si me podeis ayudar con esta pequeña duda. Quiero que al pulsar el botón "botonAceptar" de la Activity2 se envie la cadena "Aceptar" al TextView "resultado" de igual forma con el botón "botonRechazar". No me funciona y se me han agotado las ideas... Este es mi codigo:
Activity1 (a)
Bundle bundle = getIntent().getExtras();
resultado.setText(bundle.getString("ACEPTAR"));
resultado.setText(bundle.getString("RECHAZAR"))
Activity2 (b)
botonAceptar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Bundle bundle = new Bundle();
bundle.putString("ACEPTAR", "Aceptar");
Intent intent = new Intent(b.this, a.class);
intent.putExtras(bundle);
startActivity(intent);
}
});
botonRechazar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Bundle bundle = new Bundle();
bundle.putString("RECHAZAR", "Rechazar");
Intent intent = new Intent(b.this, a.class);
intent.putExtras(bundle);
startActivity(intent);
}
});