Scenario: I have 3 modules, Module A, Module B, Module C
Module A calls Module B, but Module A cannot be closed because the user needs to continue where they left off.
Now, if a users selects a certain item in Module B, Module C is called. Module B cannot be closed. Module C finishes, goes back to where user left off in B. When B finishes, goes back to where user left off in A
Problem is, if user calls B again, it will still have previous data. Same with C.
Yes, I know I can clear variables, etc... But I would like them destroyed to have the app use as little memory as possible.
The CATCH: I have set these modules so that if the user switches to a different app while it's running, it will switch back to Module A for security reasons. But Module B and C are still active and for the same security reasons, need to be destroyed until called again.
I could use flags, but if the user switches apps in Module C, module B is still active.
How can I accomplish moving between modules like this and have them destroyed when they are done?
NOTE: For security reasons, I cannot post the source code.