January 2019
Intermediate to advanced
392 pages
10h 11m
English
We mentioned in the Creating new activity section that we have passed the Parcelable user object to the MainActivity. To get this object, we need to create a request code. Let's create a request code like the following:
private val requestCode: Int = 1
Now override the onActivityResult() function, where we will retrieve the passed object of the NewUserActivity.
Here is the code of onActivityResult() function:
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { super.onActivityResult(requestCode, resultCode, data) if (requestCode == this.requestCode && resultCode == Activity.RESULT_OK){ data?.let { val users: Users = it.getParcelableExtra(getString(R.string.result_replay))
Read now
Unlock full access