Activity has leaked window that was originally added 问题解决

  在做练习的时候,切换屏幕竖恒状态时,会出现Activity has leaked window that was originally added 错误。网上查询得知原因是因为alertDilaog没有关闭所造成的。有2种解决方案:

1):

@Override protected void onPause() { super.onPause(); //关闭对话框 AlertDialog.dismiss(); }

 

2):

 AndroidManifest.xml  中给相应的<Activity>节点添加android:configChanges="orientation|keyboardHidden|navigation"

你可能感兴趣的:(android)