First you need to set up webView on your Android App with Intent. Intent will allow you to open the actual YouTube app from your webview app.
Using java Syntax Highlighting
- YOUR PACKACGE NAME SHOULD GO HERE
- import android.app.Activity;
- import android.net.Uri;
- import android.os.Bundle;
- import android.webkit.WebView;
- import android.webkit.WebViewClient;
- import android.content.Intent;
- import android.net.Uri;
- public class main extends Activity {
- /** Called when the activity is first created. */
- @ Override
- public void onCreate (Bundle savedInstanceState) {
- super. onCreate (savedInstanceState);
- setContentView (R.layout.main);
- WebView web = (WebView) findViewById (R.id.webView);
- web. getSettings().setJavaScriptEnabled (true);
- web. getSettings().setJavaScriptCanOpenWindowsAutomatically (false);
- web. getSettings().setPluginsEnabled (true);
- web. getSettings().setSupportMultipleWindows (false);
- web. getSettings().setSupportZoom (false);
- web. setVerticalScrollBarEnabled (false);
- web. setHorizontalScrollBarEnabled (false);
- web. loadUrl ("THE URL TO YOUR WEBVIEW SITE SHOULD GO HERE");
- web. setWebViewClient (new WebViewClient () {
- @ Override public boolean shouldOverrideUrlLoading(WebView view, String url) {
- if (url.startsWith("vnd.youtube")){
- startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
- return true;
- }
- else
- {
- return false;
- }
- }
- });
- }
- }
Parsed in 0.036 seconds, using GeSHi 1.0.8.4
Then when linking videos from your site to YouTube to open the YouTube app all you need is:
<a href="vnd.youtube://VIDEOID">WATCH ME</a>
Simply replace VIDEOID, with the actual video ID of the video you want to watch and when you click it, it will launch the YouTube app with the video.
I'm going to go cry now that something so simple took me forever to figure out. >_< Hopefully others can find this helpful.

