当我从主屏幕或 appDrawer 恢复应用程序时, onWindowFocusChanged() 被多次调用

发布于 2024-10-31 01:03:48 字数 597 浏览 0 评论 0原文

以下是我从应用程序移至主屏幕然后从主屏幕移回应用程序时发生的控制台输出

HOME BUTTON PRESSED TO MINIMIZE THE APPLICATION
: onWindowFocusChanged() -> hasFocus:false
APPLICATION BUTTON PRESSED TO RETURN TO THE RUNNING APPLICATION
: onWindowFocusChanged() -> hasFocus:true
: mySimpleSoundPlaybackMethods()
Now the windowFocus has already become true... then why should the following occur again???
: onWindowFocusChanged() -> hasFocus:false
: onWindowFocusChanged() -> hasFocus:true
: mySoundPlaybackMethods()

the following is my console output of what happens when i move to the homescreen from the app and then move back to the app from the homescreen

HOME BUTTON PRESSED TO MINIMIZE THE APPLICATION

: onWindowFocusChanged() -> hasFocus:false

APPLICATION BUTTON PRESSED TO RETURN TO THE RUNNING APPLICATION

: onWindowFocusChanged() -> hasFocus:true
: mySimpleSoundPlaybackMethods()

Now the windowFocus has already become true... then why should the following occur again???

: onWindowFocusChanged() -> hasFocus:false
: onWindowFocusChanged() -> hasFocus:true
: mySoundPlaybackMethods()

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

暖伴 2024-11-07 01:03:48

我将进行一个完整的猜测......也许是因为当应用程序恢复时您所触摸的任何内容都具有焦点? (再次,完全猜测)应用程序获得焦点,然后转移到您的触摸事件,然后返回到应用程序。

I'm going to throw a complete guess into the ring ... maybe because whatever you're touching has focus when the application resumes? (again, complete guess) App gets focus then transfers to your touch event then back to app.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文