If you want to finish activity, you can call the method finish() from that activity.
There are different kinds of flags available for activity:
FLAG_ACTIVITY_NEW_TASK
FLAG_ACTIVITY_CLEAR_TOP
FLAG_ACTIVITY_SINGLE_TOP
you can use then witn Intent.FLAG_ACTIVITY_NEW_TASK for any activities setFlag method parameter.
For more:
Tasks and Back Stacks and
Activities
Hopefully it may help you.