Starting second activity with Android result

1

I have two editText that I enter with an in and a compute button. I would like to present the result in a second activity as soon as I pressed the calculate button. Could someone help me with this?

    
asked by anonymous 16.12.2015 / 18:08

1 answer

2

The basic model for passing information between Acitivities is this, according to android documentation :

  Intent intent = new Intent(this, OutraActivity.class);
  EditText editText = (EditText) findViewById(R.id.meuEditText);
  String message = editText.getText().toString();
  intent.putExtra("mensagem", message);
  startActivity(intent);

And to get the OutraActivity.class :

Intent intent = getIntent();
String message = intent.getStringExtra("mensagem");

There are more examples in the documentation, enjoy and check it out, it is in English but it is very ditático.

Study references:

link

link

How do I pass parameters from the last Fragment to the previous Fragment?

Passing parameters from an Activity to other

    
16.12.2015 / 18:14