Curious, if I can invoke some 3rd party activity, and then in onActivityResult read my original intent data.
To access the returned data in the calling Activity override onActivityResult . The requestCode corresponds to the integer passed in the startActivityForResult call, while the resultCode and data Intent are returned from the child Activity.
onPause() and then onStop() methods will call when you change the activity ,,if you finish the current activity while moving to the second activity the onDestory() also called..
It has deprecated startActivityForResult in favour of registerForActivityResult . It was one of the first fundamentals that any Android developer has learned, and the backbone of Android's way of communicating between two components.
onActivityResult , startActivityForResult , requestPermissions , and onRequestPermissionsResult are deprecated on androidx.
I does not make any sence for me, really... Anyway, as the onActivityResult
will be always part of the same Activity
that launched the 3rd party activity you just have to save that data somewhere on your activity. For instance:
private Intent intentForThat3rdPartyActivity = null; // long name, huh?
public void hereYouLaunchThings(){
if( intentForThat3rdPartyActivity == null ){
intentForThat3rdPartyActivity = new Intent(YourActitity.this, The3rdPartyActivity.class);
intentForThat3rdPartyActivity.putExtra("weird", "data");
}
startActivityForResult(intentForThat3rdPartyActivity, 9999);
}
@Override
protected void onActivityResult(int requestCode, int resultCode,
Intent data) {
// this should have the same data you passed
String foo = intentForThat3rdPartyActivity.getStringExtra("weird");
}
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