I need to send data from EditText in activity A to Activity B. I tried:
Intent intent1=new Intent(A.this,B.class);
intent1.putExtra("fromA", "text");
startActivity(intent1);
But It doesn't work, because activity B has android:launchMode="singleTask"
and was created before.
How else, can I send data?
You override onNewIntent()
in the Activity B
and receive the intent
in that method.
Like below code:
@Override
protected void onNewIntent(Intent i)
{
String s = i.getStringExtra("fromA");
}
In the above code you will get value to s
from Activity A
.
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