执行我的应用程序时,我在 logcat 中收到此消息。
Activity com.jeslomo.judokatium_2.CinturonActivity has leaked ServiceConnection com.google.android.youtube.player.internal.r$e@42201a30 that was originally bound here
我尝试加载 youtube 的 Intent :
Intent intent = YouTubeStandalonePlayer.createVideoIntent(acty, API_KEY , videoId, 0, false, false); acty.startActivity(intent);
但视频加载正确。
“acty”是我传递给 BaseAdapter 以加载视频的 Activity 。
我该如何解决?
谢谢!!
P.D:对不起我的英语不好。
最佳答案
请试试这个希望它的工作:
当第二个页面出现时加载 api,然后初始化 YouTube API。不要将您的 Activity 作为上下文提供,而是尝试将应用程序上下文提供给 api。
Intent intent = YouTubeStandalonePlayer.createVideoIntent(getApplicationContext(), API_KEY , videoId, 0, false, false);
acty.startActivity(intent);
关于android - Activity 泄露了原本绑定(bind)在这里的 ServiceConnection com.google.android.youtube.player.internal.r$e@42201a30,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21413124/