You could use a code file and add a global 'PreviousActivity' field. At the end of each activity pause you set that one as the 'previous'. In the Activity resume you can check the 'Previous' for its value and act accordingly.
The method written above works when all activities are in the same project or are using the same code module.