Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

刚打开悬浮窗,迅速返回桌面,程序会崩溃 #2

Open
panliming-tuya opened this issue Mar 21, 2016 · 3 comments
Open

刚打开悬浮窗,迅速返回桌面,程序会崩溃 #2

panliming-tuya opened this issue Mar 21, 2016 · 3 comments

Comments

@panliming-tuya
Copy link

java.lang.IllegalArgumentException: View not attached to window manager
at android.view.WindowManagerGlobal.findViewLocked(WindowManagerGlobal.java:406)
at android.view.WindowManagerGlobal.updateViewLayout(WindowManagerGlobal.java:295)
at android.view.WindowManagerImpl.updateViewLayout(WindowManagerImpl.java:74)
at cn.finalteam.floatviewfinal.widget.FloatView$1.handleMessage(FloatView.java:90)

@panliming-tuya
Copy link
Author

已解决, 调用destory之前应该先调用一次hide

@PPJLiuJie
Copy link

目前发现两个Bug。
1.第一次打开悬浮窗,在加载动画执行完毕之前,按返回键返回桌面,程序奔溃
2.第一次打开悬浮窗,在加载动画执行完毕之前,如果屏幕旋转,程序奔溃
这两次奔溃的错误跟1楼所述一样,不过楼主在destroy之前已经调用了hide方法,不知道1楼所说的是哪里调用一次hide方法

@PPJLiuJie
Copy link

问题解决了。
开始我一直不理解为什么要在FloatView的detroy方法中调用:
try {
mTimerHandler.removeMessages(1);
} catch (Exception e){}
现在我明白了,是为了将对应的消息从队列中取消掉,但是FloatView中消息对应的what有两个,一个是HANDLER_TYPE_HIDE_LOGO = 100,一个是HANDLER_TYPE_CANCEL_ANIM = 101,所以将上述代码改为:
try {
// mTimerHandler.removeMessages(1);
mTimerHandler.removeMessages(HANDLER_TYPE_CANCEL_ANIM);
mTimerHandler.removeMessages(HANDLER_TYPE_HIDE_LOGO);
} catch (Exception e){}

即可解决问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants