Reputation: 2535
I have an Activity -> MasterActivity and one more Activity ChildActivity which extends from Master Activity
Now the author of Master activity is expecting some values to come with the intent and parses these in the onCreate of Master activity:
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_view)
origUrl = intent.getStringExtra(EXTRA_URL)
if (origUrl == null) throw RuntimeException("did you forget to put extras?")
}
And I start the intent to my ChildActivity like:
context?.startActivity(Intent(context, TerminationWebview::class.java).apply {
putExtra(ChildActivity.EXTRA_URL, it)
Now the question is how do I pass this data to parent? So that parent can parse it in onCreate?
This question does not deal with returning data from an activity, it deals with passing the data to parent activity through intent and hence is not . a duplicate
Upvotes: 1
Views: 548
Reputation: 1189
You could do this by getting your intent data directly from the MasterActivity#onCreate
You might also want to change the tag to kotlin instead of java.
Upvotes: 1