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.
You can start activity B with startActivityForResult (Intent intent, int requestCode), after which you can close activity B by calling finishActivity (int requestCode).
startActivityForResult (Intent intent, int requestCode)
finishActivity (int requestCode)
What you have to do is start your business with startActivityForResult(yourIntent, childId);
startActivityForResult(yourIntent, childId);
, , finishActivity(childId);
finishActivity(childId);
,
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.