Issue
I want to play a Youtube Video on a click of a Button
but getting action dialog window that I don't want to show, I want youtube video link should open directly on Youtube app on Button click rather than showing this choose action window :
How is it possible ? Any Suggestion please
code :
playVideo.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.youtube.com/watch?v=bzSTpdcs-EI")));
}
});
Solution
you can set package name of youtube application
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.youtube.com/watch?v=bzSTpdcs-EI"));
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setPackage("com.google.android.youtube");
startActivity(intent)
Answered By - Ravi
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.