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

随声附和 提交于 2019-12-03 06:48:55

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 :)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!