Note that there are some explanatory texts on larger screens.

plurals
  1. POActivity lifecycle issue - upgraded to 4.0.3
    primarykey
    data
    text
    <p>I have all activities inherit from my BaseActivity. It's been working great for a year. Now after I upgraded my Nexus S to 4.0.3 my app stopped working - I get infinite loop that look like so:</p> <pre><code>12-28 20:09:22.285: DEBUG/IDATT.HomeActivity(24662): onCreate 12-28 20:09:22.285: DEBUG/IDATT.BaseActivity(24662): onCreate 12-28 20:09:22.442: DEBUG/IDATT.HomeActivity(24662): onResume 12-28 20:09:22.442: DEBUG/IDATT.BaseActivity(24662): onResume 12-28 20:09:22.578: DEBUG/IDATT.HomeActivity(24662): onCreate 12-28 20:09:22.578: DEBUG/IDATT.BaseActivity(24662): onCreate 12-28 20:09:22.653: DEBUG/IDATT.HomeActivity(24662): onResume 12-28 20:09:22.653: DEBUG/IDATT.BaseActivity(24662): onResume 12-28 20:09:22.785: DEBUG/IDATT.HomeActivity(24662): onCreate 12-28 20:09:22.785: DEBUG/IDATT.BaseActivity(24662): onCreate 12-28 20:09:22.863: DEBUG/IDATT.HomeActivity(24662): onResume 12-28 20:09:22.863: DEBUG/IDATT.BaseActivity(24662): onResume </code></pre> <p>So, when <code>HomeActivity</code> started it calls base.onCreate which is second line. Then <code>onResume</code> called and for some reason after that - BaseActivity.onCreate called again.</p> <p>Does this make sense? One thing I noticed is that everything runs OK until I turn screen. Then it starts blinking. Even if I hit Home and open application again. But if I kill process and restart it looks good until I try to flip screen again..</p> <p>EDIT: I removed all the code samples - they not relevant. Seems like I found my issue. I did override <code>onConfigurationChange</code> in my <code>Application</code></p> <pre><code>@Override public void onConfigurationChanged(Configuration newConfig) { Log.d(LOG_TAG, "onConfigurationChanged"); super.onConfigurationChanged(newConfig); //reset locale to our defined locale in settings // String l = Preferences.getLocale(getApplicationContext()); // Locale locale = new Locale(l); // if (!l.equals("")) // { // newConfig.locale = locale; // Locale.setDefault(locale); // getBaseContext().getResources().updateConfiguration(newConfig, getBaseContext().getResources().getDisplayMetrics()); // } } </code></pre> <p>Commented code caused issue. Seems like doing what I did (to change locale) caused whole UI to restart and it was doing it repeatedly. Now I need to come up with better way.</p> <p>So, there is breaking change in this Locale area in 4.0</p>
    singulars
    1. This table or related slice is empty.
    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.
 

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