android - Does bringing an activity to the foreground call its onCreate method? -
pretty self explanatory question. if start activity b activity , user subsequently presses or home, activity b destroyed , activity comes foreground. activity a's oncreate
method guaranteed called? seems way me. wanted check.
no. when activity comes foreground guaranteed activity a's onstart()
called. can put log.i()
inside oncreate(), onstart()
callbacks check yourself. but, if in low-memory, , gc, chance, clear savedinstancestate
state of activity a, system needs call oncreate()
again.
so based on internal condition of system, calls oncreate()
, onstart()
, or onresume()
. nothing guaranteed.
you see above picture, arrow pointed oncreate(), onstart(), onpause().
Comments
Post a Comment