This is the navigation of my application:
Activity1callsActivity2→Activity2.finish(), callActivity3→Activity3.finish()
When Activity3 finishes, it calls the onResume method of Activity1. Now how can I pass a value from Activity3 to Activity1?
Umesh shows a good technique but I think you want the opposite direction.
Step 1
When starting Activity 2 and 3, use
startActivityForResult. This allows you handle the result in the calling activity.Step 2
In Activities 2 and 3, call
setResult(int, Intent)to return a value:Step 3
In your calling activty, implement
onActivityResultand get the data:Edit:
Technique #2
Yes, you can also use global application state by adding a class to your application that extends
Application, see this StackOverflow answer