Android警告:Activity has leaked window xxx was originally added here
795 ワード
エラーの原因は、携帯電話が横、縦画面切り替え時に発生したため、処理方法:
1、AndroidManifest.xmlには、エラーのActivityが追加されています.
2、エラーのActivityにコードを付ける:
1、AndroidManifest.xmlには、エラーのActivityが追加されています.
android:launchMode="singleInstance" android:configChanges="orientation|keyboardHidden"
2、エラーのActivityにコードを付ける:
@Override
public void onConfigurationChanged(Configuration newConfig)
{
super.onConfigurationChanged(newConfig);
if (this.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE)
{
//land
}
else if (this.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT)
{
//port
}
}