MediaController泄露活动

我正在使用MediaPlayer和MediaController对象来传输音频。 关闭活动时,我得到一个窗口泄漏异常。

在我的活动中,我有以下几点,根本没有任何帮助。

@Override
protected void onStop() {
    super.onStop();
    mediaController.hide();

}

我得到以下堆栈跟踪:

01-24 20:11:18.317:E / WindowManager(26286):活动co.uk.ing_simmons.aberdeensoundsites.RecordingDetails泄露了最初在此处添加的窗口com.android.internal.policy.impl.PhoneWindow$DecorView@4182d590 01 -24 20:11:18.317:E / WindowManager(26286):android.view.WindowLeaked:Activity co.uk.ing_simmons.aberdeensoundsites.RecordingDetails泄露了窗口com.android.internal.policy.impl.PhoneWindow$DecorView@4182d590最初在这里添加01-24 20:11:18.317:E / WindowManager(26286):在android.view.ViewRootImpl。(ViewRootImpl.java:418)01-24 20:11:18.317:E / WindowManager(26286):在android.view.WindowManagerImpl.addView(WindowManagerImpl.java:294)01-24 20:11:18.317:E / WindowManager(26286):在android.view.WindowManagerImpl.addView(WindowManagerImpl.java:226)01-24 20 :11:18.317:E / WindowManager(26286):在android.view.WindowManagerImpl $ CompatModeWrapper.addView(WindowManagerImpl.java:151)01-24 20:11:18.317:E / WindowManager(26286):在android.view。窗口$ LocalWind owManager.addView(Window.java:547)01-24 20:11:18.317:E / WindowManager(26286):at android.widget.MediaController.show(MediaController.java:470)01-24 20:11:18.317: E / WindowManager(26286):在android.widget.MediaController.show(MediaController.java:429)01-24 20:11:18.317:E / WindowManager(26286):在co.uk.ing_simmons.aberdeensoundsites.RecordingDetails $ 2。运行(RecordingDetails.java:202)01-24 20:11:18.317:E / WindowManager(26286):at android.os.Handler.handleCallback(Handler.java:615)01-24 20:11:18.317:E / WindowManager(26286):在android.os.Handler.dispatchMessage(Handler.java:92)01-24 20:11:18.317:E / WindowManager(26286):在android.os.Looper.loop(Looper.java:153 )01-24 20:11:18.317:E / WindowManager(26286):在android.app.ActivityThread.main(ActivityThread.java:5006)01-24 20:11:18.317:E / WindowManager(26286):在java .lang.reflect.Method.invokeNative(Native Method)01-24 20:11:18.317:E / WindowManager(26286):在java.lang.reflect.Method.invoke(Method.java:511)01-24 20: 11:18.317:E / Windo wManager(26286):at com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:821)01-24 20:11:18.317:E / WindowManager(26286):at com.android.internal.os .ZygoteInit.main(ZygoteInit.java:584)01-24 20:11:18.317:E / WindowManager(26286):at dalvik.system.NativeStart.main(Native Method)01-24 20:11:18.325:E / InputEventReceiver(26286):频道'41c81858面板:co.uk.ing_simmons.aberdeensoundsites / co.uk.ing_simmons.aberdeensoundsites.RecordingDetails(client)'〜发布者关闭输入频道或发生错误。 事件= 0x9

这似乎指向202线这是这条线:

mediaController.show();

我一直在Google上搜索几个小时,并且字面意思是说,在onStop方法中放置“mediaController.hide()”以防止泄漏。 这显然不工作,因此任何帮助或指导将不胜感激。

谢谢


你可能想要扭转线条

super.onStop();
mediaController.hide();

mediaController.hide();
super.onStop();
链接地址: http://www.djcxy.com/p/19935.html

上一篇: MediaController leaking on activity

下一篇: Window Leaked even on dialog.dismiss()