android - Activity 泄露了原本绑定(bind)在这里的 ServiceConnection com.google.android.youtube.player.internal.r$e@42201a30

标签 android android-intent youtube

执行我的应用程序时,我在 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/

相关文章:

安卓指纹原始数据

android - 如何为 Android ant 调试版本指定调试 keystore 的位置?

android - 错误 : Final local variable score cannot be assigned, 因为它是在封闭类型中定义的?

android - 想要播放YouTube视频,并将代码嵌入到webview中,并且在同一webview中显示html内容

javascript - 在播放另一个 YouTube iframe 时停止任何嵌入式 YouTube iframe

java - 当cursor.movetofirst为假时该怎么办(SQLite)

java - 我想检索适配器文件中的图像 url

android - 检查电话号码存在于android的联系人列表中

android - 使用singleTask时如何处理每个Intent

android - 在 Android 上实现 youtube 书签应用