Skip to content Skip to sidebar Skip to footer

How To Keep Always Up-to-date Reference To Activity

I have two Activities and I want to keep a reference of a second Activity in a first Activity. What would be the best way to keep the reference always up-to-date because as far as

Solution 1:

I want to keep a reference of a second Activity in a first Activity.

You absolutely positively do NOT want to do this. Find another solution for whatever problem you think you are trying to solve.

To clarify, this will introduce memory leaks.

Solution 2:

I'm not sure i follow the question, but anytime you launch an activity the other stays on the stack and you don't lose it.

Take a look at android:launchMode for a better explanation of this and the several options you have.

Hope I understood the question right!

Post a Comment for "How To Keep Always Up-to-date Reference To Activity"