Open Youtube Channel calling YouTube App (Android)

C4TInD picture C4TInD · May 12, 2013 · Viewed 7.1k times · Source

I want to open YouTube App showing an specific channel, but this only execute the browser.

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

I want to show this:

enter image description here

Answer

Chor Wai Chun picture Chor Wai Chun · May 13, 2013

Do research on library called YouTubeAndroidPlayerApi. This piece of code does exactly what you want.

Intent intent = YouTubeIntents.createUserIntent(this, channelName);
startActivity(intent);