Which type of data can be garbage collected when app is in background?
Posted
by
Neoh
on Stack Overflow
See other posts from Stack Overflow
or by Neoh
Published on 2013-07-03T09:00:01Z
Indexed on
2013/07/03
11:05 UTC
Read the original article
Hit count: 176
android
|garbage-collection
Let's say I start from activity A -> activity B. While in activity B I press home to exit. After a long time, gc may be called because other apps take higher priority. My question is, which of the following type of data will be garbage collected (I'm pretty sure static fields can be garbage collected any time but I'm not sure about these):
i) fields that are declared final
or static final
ii) intent and its data that I passed from activity A to activity B
iii) onSavedInstanceState when orientation is changed during the app running
I ask this because I want to ensure that my app won't crash when I restore activity B from background after a long period.
© Stack Overflow or respective owner