let's say I have 2 activities A and B. I go to B from A then hit the Home button. there are a few static vars being initialized in A.
after a few hours or days or until activity is being killed, I launch the app again from the Recent button. activity B becomes the new entry point of this app, but static vars are no longer holding any value and has no chance of getting initialized unless I redirect back to A.
my launchMode
for both activities are singleTop
. not sure if that matters but I've tried singleTop
, singleInstance
and standard
none of them work. I guess my expected behavior would be the entry point is always A or any other activities if is not being killed and of course static vars are still holding value.
Thanks!
If static variables doesn't work, you can try using
getter()
andsetter()
methods for variables.