This is a basic question but I need some help with it.
I have two activities : actA, actB. While in actA I want to start actB and give it a String, than I want to end actB and return another String to actA (I don't want to go to onCreate() of actA, I would much rather return this value to some method in actA so it can use the String from actB.
Help is appreciated
From A.java:
Intent myintentB=new Intent(A.this, B.class).putExtra("<StringName>", "Value");
startActivityForResult(myintentB, 3);
from B.java:
Intent myintentA=new Intent(B.this, A.class).putExtra("<StringName>", "Value");
finish();
setResult(3, myintentA);
In A.java
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// TODO Auto-generated method stub
super.onActivityResult(requestCode, resultCode, data);
String result_string=data.getStringExtra("<StringName>");
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With