gpt4 book ai didi

锁屏后调用Android onCreate

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:09:12 28 4
gpt4 key购买 nike

当我的应用程序“在顶部”运行时锁定屏幕时,系统几乎立即调用 onCreate(屏幕仍然是黑色的)。这种破坏性行为的原因可能是什么?

最佳答案

对我来说

android:configChanges="orientation"

但这没有帮助,因为我的 Activity 是全屏的,所以我添加了

android:configChanges="keyboardHidden|orientation|screenSize"

在 Activity 标签中

Handling the Configuration Change Yourself 中所述

If your application doesn't need to update resources during a specific configuration change and you have a performance limitation that requires you to avoid the activity restart, then you can declare that your activity handles the configuration change itself, which prevents the system from restarting your activity.

关于锁屏后调用Android onCreate,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16320040/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com