What could cause an Android activity to relaunch itself infinitely when returning from camera? What could cause an Android activity to relaunch itself infinitely when returning from camera? android android

What could cause an Android activity to relaunch itself infinitely when returning from camera?


After much investigation, it appears the call to relaunch is coming from onConfigurationChanged. I still haven't figured out why, but at least I know what to avoid.

It explains why some cameras triggered this bug and others not: some cameras used the same configuration as my application, others not.

EDIT: I've discovered after other investigations that I had a bug in my extended Application class. In the onConfigurationChanged method, I was changing the configuration by forcing a certain locale. This was triggering a new onConfigurationChanged() call, which caused an infinite loop and the subsequent screen create/destroy sequence. I have no idea why I've put that code in the onConfigurationChanged() method, but I guess you have to suffer in order to learn :)