Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid Activity Life Cycle in Jelly Bean
    primarykey
    data
    text
    <p>I have been developing an application for a few months now and getting ready to go to release. I have been using the Motorola Xoom with Android 4.0.4 for testing throughout the process and everything has worked without fail. I purchased a Nexus 7 from Google (running Jelly Bean 4.1) and I am now getting all kinds of problems with the activity life cycle when the device sleeps or turns off.</p> <p>I created a new project for the sole purpose of checking the life cycle and this is the results I came up with. The following code is a sample of what I have done in each of the life cycle methods.</p> <pre><code>@Override protected void onPause() { Log.i("TEST", "onPause()"); super.onPause(); } </code></pre> <p>Results from Xoom (expected results)</p> <pre><code>---------- Program Launch ------------- onCreate(null) onStart() onResume() ---------- Turn Off Screen ------------ onPause() onSaveInstanceState(not null) onStop() ---------- Turn Screen On ------------- onReStart() onRestoreInstanceState(not null) onResume() </code></pre> <p>Results from Nexus 7 (unexpected results)</p> <pre><code>---------- Program Launch ------------- onCreate(null) onStart() onResume() ---------- Turn Off Screen ------------ onPause() onSaveInstanceState(not null) onStop() onDestroy() onCreate(not null) onStart() onRestoreInstanceState(not null) onResume() onPause() ---------- Turn Screen On ------------- OnResume() onPause() onSaveInstanceState(not null) onStop() onDestroy() onCreate(not null) onStart() onRestoreInstanceState(not null) onResume() </code></pre> <p>Again, these results are from a brand new project with no code changes other than the Log statements in each of the methods. Why are there so many additional, unnecessary method calls when the Nexus 7 gets turned off and back on? It seems to be completely destroying the application and then recreating.</p> <p>For completeness sake, when using the home button and then relaunching the application, the life cycle seems to be consistent between devices.</p> <p>Thanks in advance for any help. Wayne</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload