Android closes child activity from parent activity

I wanted to close childhood activity from parental activity. My flow is similar: activity A is open, inside Activity A I open operation B. But at the same time, my activity A performs some background task. When I got the result of my background task, I wanted to close step B of Step A.

Is it possible to do this? Help is needed. Thank.

+12
source share
3 answers

You can start activity B with startActivityForResult (Intent intent, int requestCode), after which you can close activity B by calling finishActivity (int requestCode).

+23
source

What you have to do is start your business with startActivityForResult(yourIntent, childId);

, , finishActivity(childId);

,

+5

you don’t need to end () every activity, as soon as you leave it, Android will do it for you. so you just restart Activity A in the top task.

+1
source

All Articles