I start an activity using the following code for a given result:
startActivityForResult(
new Intent(
getActivity(),
StudentDetails.class
).putExtra(
GeneralFunctions.EXTRA_STUDENT_ID,
(String) studentsListInUse.get(index)
.valueForKey(GeneralFunctions.STUDENT_ID)
),
GeneralFunctions.REQUEST_STUDENTS_EDITING
);
Then in some other point I finish it:
finishActivity(GeneralFunctions.REQUEST_STUDENTS_EDITING);
And start it again with another student´s data:
startActivityForResult(
new Intent(
this,
StudentDetails.class
).putExtra(
GeneralFunctions.EXTRA_STUDENT_ID,
(String) attendance.valueForKey(GeneralFunctions.STUDENT_ID)
),
GeneralFunctions.REQUEST_STUDENTS_EDITING
);
The problem is, when I go back the screens, every single activity displaying student´s details remain on the stack. In the documentation there's nothing besides:
The request code of the activity that you had given to startActivityForResult(). If there are multiple activities started with this request code, they will all be finished.
So what extra detail is missing here? It should simply finish all activities that were started with a given resultCode.