I am at activity A, and launching some other activities such as B and C with the launcher like this

private val resultLauncher = registerForActivityResult(ActivityResultContracts.StartActivityForResult()) {
        if (it.resultCode == RESULT_OK) {
            // any way to get activity name that set the result?
        }
    }

// Launch activity B by a button click
resultLauncher.launch(Intent(this, B::class.java))

// Launch activity C by a button click
resultLauncher.launch(Intent(this, C::class.java))

When finishing both B and C, I use this code

setResult(RESULT_OK) // don't want to put Intent data to this method
finish()

So Does the ActivityResult param in registerForActivityResult contain any info of the activities (such as simpleClassName) that call setResult and go back to activity A? I don't want to put the intent data to setResult method

1

There are 1 best solutions below

0
CommonsWare On BEST ANSWER

So Does the ActivityResult param in registerForActivityResult contain any info of the activities (such as simpleClassName) that call setResult and go back to activity A?

No. The documentation for ActivityResult shows that it contains the result code Int and the Intent that get delivered to onActivityResult().