I have a static value in a mainActivity.java that needs to be accessed through multiple activities. What is the best way to do this? I can only think of one way to implement this. I never “finish()” the mainActivity.java. Other activities that are spawned from mainActivity that access the static value are finished though. I am a novice to android programming so all the help is appreciated.
Share
A static attribute does not belong to any instance but the class itself.
And the static value will persist even after the activity is finished.
So you can access a static value of the activity by
Hope this would help.