当我从主屏幕或 appDrawer 恢复应用程序时, onWindowFocusChanged() 被多次调用
以下是我从应用程序移至主屏幕然后从主屏幕移回应用程序时发生的控制台输出
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我将进行一个完整的猜测......也许是因为当应用程序恢复时您所触摸的任何内容都具有焦点? (再次,完全猜测)应用程序获得焦点,然后转移到您的触摸事件,然后返回到应用程序。
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.