从我的应用程序中搜索的Youtube应用程序的特定字符串
问题描述:
我有一个按钮,当我点击它,我想调用的Youtube应用程序和搜索predefined字符串(搜索字符串是不变的,我的意思是YouTube应用程序会自动显示的结果)。 我知道,搜索频道,我们把
I have a button that when i tap on it i want to invoke Youtube app and search for predefined string(the search string is constant, i mean that Youtube app will display automatically the results). I know that for searching a channel, we put
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("http://www.youtube.com/user/channel"))
但如何寻找一个特定的视频(字符串常量)? 感谢您的帮助。
But what about searching for a specific video (constant string)? Thank you for your help.
答
试试这个意图在YouTube上搜索:
try this Intent For Search on Youtube :
Intent intent = new Intent(Intent.ACTION_SEARCH);
intent.setPackage("com.google.android.youtube");
intent.putExtra("query", "Android");
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);