Reputation: 421
I want to use my application to upload videos on YouTube. I'm using this code:
uploadIntent.setDataAndType(Uri.fromFile(f), "video/quicktime");
startActivity(Intent.createChooser(uploadIntent, "Upload"));
but it also shows me options for bluetooth, gmail etc. when I want to it to display only the YouTube option. How can I display only the YouTube option?
Upvotes: 0
Views: 1025
Reputation: 36302
I had misunderstood what you were asking. It seems that you have the upload working but want to restrict it to only YouTube. To achieve this, you should not use Intent.createChooser
since there's no point in choosing if you only want to display one option. Instead, you can use Intent.setClassName
to specify the package and class for YouTube.
You can discover the correct values by simply examining the Intent
s passed back in your current code when you select YouTube. You'll want to set the return value of from Intent.createChooser
PackageManger.queryIntentActivites
to a local variable, set a breakpoint in the line after and examine the contents of the YouTube Intent
when it breaks.
Upvotes: 2