单击带有在 youtube 中搜索的查询的按钮后,如何从另一个应用程序打开 Youtube 应用程序?

How to open Youtube app from another app after clicking a button with a query searched in youtube?

我应该在我的 activity 中定义什么,即 Action、ActivityClass、ActivityPackage、ExtraKey 和 ExtraValue,以在应用程序中定义打开 Youtube 应用程序的意图,以及 android phone 打开在 youtube 中搜索了 "ExtraValue"? 我正在尝试以下组合,但收到错误 601。

Action: android.intent.action.SEARCH
ActivityClass: com.google.android.youtube.WatchActivity
ActivityPackage: com.google.android.youtube
DataType: 
DataUri: 
ExtraKey: query
ExtraValue: app Inventor activity starter
ResultName: 

在您的项目中使用它: https://developers.google.com/youtube/android/player/downloads/

在您的 onclick 方法中包含此代码:

Intent intent = YouTubeStandalonePlayer.createVideoIntent(getActivity(), api_key, video_id);
startActivity(intent);

api_key 是 Google 控制台 API 开发者密钥。 video_id是v=后面的代码,for example:fYWZNN4bbz8 in "https://www.youtube.com/watch?v=fYWZNN4bbz8"

:)