Your Activity
will be destroyed, and all it's members will get garbage collected (if there are no other references to them). Therefore, never keep a reference to your Activity
outside its own scope, or it will not get garbage collected!
Depending on the type of objects you're creating, you can use onSaveInstanceState
and onRestoreInstanceState
to save and restore them, obviously. This might speed up things a little (for example, instead of re-reading objects from a database).
Note that this will recreate the objects as well, instead of referring to the same object. It just might be a bit quicker.