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

    

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

        分类:             android                   2972人阅读     评论(2)     收藏     举报    
android

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

1):

[java] view plain copy print ?
  1.    @Override  
  2. protected void onPause()   
  3. {  
  4.     super.onPause();  
  5.        //关闭对话框  
  6.     AlertDialog.dismiss();  
  7. }  
@Override protected void onPause() { super.onPause(); //关闭对话框 AlertDialog.dismiss(); }

 

2):

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

你可能感兴趣的:(android)