android activity singleTop, onPause() then unexpected onCreate() -


well here's weird 1 that's been making eyes cross few hours.

please patient, of explanation.

i have activity. launchmode singletop. i've got log statements in can see of various lifecycle routines being executed.

i start said activity , goes thru

oncreate() onstart() onresume() 

the activity passed intent , intent picked runs after onresume()

i think following happen because activity gets pushed background because of incoming cell phone call.

onpause() <---- since have not pressed indicating activity on saves state 

while i'm out of app running activity, os needs more resources , that, think, explains why called:

onstop()  

then navigate app , see runs:

onnewintent()  

ok. think understand - runs because that's how os communicates activity defined singletop after been started. right?

then see

 onrestart()  onstart()  onresume() 

which standard stuff

then hit home, prior running consume lot of resources , force os kill app

i see

onpause() <- saves state onstop() 

when navigate see

oncreate() onstart() onresume() 

which makes sense because activity killed , i've navigated back. oncreate() how start wasn't running (since killed). onstart() , on resume() part of normal lifecycle.

so hit home again, os kills app

onpause() <- saves state onstop() 

and go it

oncreate() onstart() onresume() 

here's things odd:

i'm done activity , hit leave it

onpause()  <------- detect pressed not save state , delete saved state oncreate() <------- what? 

i expected see standard stuff comes after onpause() onstop() , ondestroy() reason doesn't happen.

the os runs oncreate() again since activity on , tried leaving hitting key detected in onpause() , no state saved.

oncreate() thinks running on again. there no intent data ,

since intent delivered in first oncreate() gone , i've deleted saved state oncreate() succumbs nullpointerexception

what on earth going on? more importantly, how make activity die , stay dead?

edit 1:

some new information came light.
in problematic onpause()/oncreate() sequence describe above logged value of isfinished(). shows

onpause() - isfinishing() true.  expect. oncreate() - isfinishing() false!?   

so os staring activity again. why?


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -