StupidBeauty
Read times:2138Posted at: - no title specified

转载 Solution of java.lang.IllegalArgumentException: View not attached to window manager

如果某个活动已经被销毁,还在该活动的上下文里弹出或者关闭对话框的话,会导致“java.lang.IllegalArgumentException: View not attached to window manager”异常。解决办法就是,在弹出或关闭对话框之前,使用isFinishing()检查一下该活动是否还存活着。

http://www.hankcs.com/program/mobiledev/solution-java-lang-illegalargumentexception-view-not-attached-to-window-manager.html

亮点

@Override

public void dismiss()

{

if (mParentActivity !=  null && !mParentActivity.isFinishing())

{

super .dismiss();     // 调用超类对应方法

}

}

Your opinions

Your name:Email:Website url:Opinion content:
- no title specified

HxLauncher: Launch Android applications by voice commands