打开Youtube频道,拨打YouTube应用(Android)

0 youtube android channel youtube-channels

我想打开显示特定频道的YouTube应用,但这只会执行浏览器.

try 
        {
            Intent intent = new Intent(Intent.ACTION_VIEW);
            intent.setData(Uri.parse("http://www.youtube.com/"+channel));
            startActivity(intent);
        }
        catch (Exception e) 
        {
            startActivity(new Intent(Intent.ACTION_VIEW,Uri.parse("http://www.youtube.com/"+channel)));         
        }
Run Code Online (Sandbox Code Playgroud)

我想表明这一点:

在此输入图像描述

Pir*_*hah 8

使用此代码将打开频道

 startActivity(new Intent(Intent.ACTION_VIEW,   Uri.parse("http://www.youtube.com/channel/UCw7FqRl9XzrlB_D1vOg_Gyg")));
Run Code Online (Sandbox Code Playgroud)


Cho*_*hun 6

对图书馆的研究称为YouTubeAndroidPlayerApi.这段代码完全符合您的要求.

Intent intent = YouTubeIntents.createUserIntent(this, channelName);
startActivity(intent);
Run Code Online (Sandbox Code Playgroud)