Question

I launch an Activity B from Activity A with startActivityForResult() and Activity B is translucent then Activity's A method

protected void onActivityResult(int requestCode, int resultCode, Intent data) {} 

works immediately even Activity B is open.

Please suggest.

Was it helpful?

Solution

I just had the exact same problem. I solved it by removing the Intent.FLAG_ACTIVITY_NEW_TASK flag from the intent used to call Activity B. You could also check if there is singleInstance or singletop in your manifest in Activity B.

"You can't use startActivityForResult() if your activity is being launched as a singleInstance or singleTop."

Source : Android - startActivityForResult immediately triggering onActivityResult

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top