I am making an application in which I want to broadcast variable value on button click.
At the same time I want to receive this value in other activity and display it.
How should I do the same ?
I am making an application in which I want to broadcast variable value on
Share
Seems to me like you can use a global variable , which can be used across activities.(Also answering some unasked questions 😉 )
For the same, you can extend android.app.Application class,
Example from Another question,
Then in your activities you can get and set the variable like so:
As given in the example, set your variable from one activity (or button click whatever) and get that value in another activity.