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.
Activity1
Activity2
MainActivity
You can use:
public ComponentName getCallingActivity()
to know which Activity called your current Activity.
Activity