android youtube:将 youtube 视频分享到我的应用程序? [英] android youtube: share a youtube video TO my app?

查看:26
本文介绍了android youtube:将 youtube 视频分享到我的应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

适用于平板电脑的内置 YouTube 应用具有共享选项.例如:我在 YouTube 应用中观看视频并点击按钮分享.蓝牙、Googlemail 和 Dropbox 出现在我面前.我想知道如何在那里列出我的应用?我的应用程序有哪个意图过滤器?我如何获取视频网址呢?任何的想法?谢谢.

The built in YouTube App for tablets has a sharing-option. For example: I watch a video in the YouTube app and click the button to share. Bluetooth, Googlemail, and Dropbox appear for me. I wonder how i can list my app there? Which intent-filter has my app to have? How do i get the video url then? Any idea? Thanks.

推荐答案

这对我有用.将此 Intent 过滤器添加到您的清单文件中,以使您的应用程序显示在 youtube 应用程序的共享列表中.

This worked for me. Add this intent filter to your manifest file to make your application appear in the share list of the youtube application.

<intent-filter>
   <action android:name="android.intent.action.SEND" />
   <category android:name="android.intent.category.DEFAULT" />              
   <data android:host="www.youtube.com" android:mimeType="text/*" />
</intent-filter>

然后要在您的活动中检索它,请使用:

Then to retrieve it in your activity, use this :

Bundle extras = getIntent().getExtras();
 String value1 = extras.getString(Intent.EXTRA_TEXT);

你来了!

这篇关于android youtube:将 youtube 视频分享到我的应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆