Context extension function
Steps back up a context chain till it reaches the last activity
Activity this context belongs to
if this context does not belong to an activity