Search a specific string in Youtube application from my app

北战南征 提交于 2019-12-21 02:04:07

问题


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.


回答1:


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);


来源:https://stackoverflow.com/questions/9860456/search-a-specific-string-in-youtube-application-from-my-app

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!