我在Activity的custom Dialog
方法之外的方法中创建onCreateDialog
。当设备的方向发生变化时,我得到了许多其他人得到的通常泄露的窗口错误:
06-15 23:47:07.712: E/WindowManager(964): Activity com.betweenthehills.TestVideoPlayerActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@44ef8438 that was originally added here
06-15 23:47:07.712: E/WindowManager(964): android.view.WindowLeaked: Activity com.betweenthehills.TestVideoPlayerActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@44ef8438 that was originally added here
我意识到我需要在Activity被销毁之前解除对话框;但我无法重写Activity方法。有没有办法在活动onPause>onDestroy
周期开始之前检测方向变化?