Alex Rivera | Logout

Android get previous activity

Asked 2011-11-14T09:30:24.267
50

I have 2 activities: Activity1 and Activity2. In each of this activities there is a button that leads me to a third activity (MainActivity). In MainActivity I want to know from which activity page was called.

Edit
Report

1 Answer

24

You can use:

public ComponentName getCallingActivity()

to know which Activity called your current Activity.

answered 2011-11-14T09:42:08.697

Your Answer