I want to play YouTube videos inside my android app. How can I do it without downloading the YouTube API? I found the following code here on stack overflow:
new Thread(new Runnable() {
@Override
public void run() {
final WebView myWebView = (WebView) findViewById(R.id.webView1);
myWebView.setWebViewClient(new WebViewClient());
myWebView.getSettings().setJavaScriptEnabled(true);
myWebView.setWebChromeClient(new WebChromeClient());
try {
Log.e("Status", "tried url");
myWebView.loadUrl(icobj.video_URL);
handler.post(new Runnable() {
@Override
public void run() {
Log.e("Status", "In Run():");
}
});
} catch (Exception e) {
e.printStackTrace();
Log.e("Status", "exception");
}
}
}).start();
But "handler cannot be resolved to a variable" error is shown. Please help!!