I have been working on an appliction, the requirement states that i need to open a Youtube link on the web view. Once clicked on the video i need to open the Youtube application to play the video.
After lots of try had not been quite successful to achieve this goal! Looking forward for sugestions.
this is what i tried.
wb = (WebView)findViewById(R.id.web);
wb.getSettings().setJavaScriptEnabled(true);
wb.setWebViewClient(new MyClient());
wb.getSettings().setPluginsEnabled(true);
wb.getSettings().setPluginState(PluginState.ON_DEMAND);
wb.getSettings().setAllowFileAccess(true);
wb.getSettings().setAppCacheEnabled(true);
wb.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
wb.loadUrl("http://m.youtube.com");
private class MyClient extends WebViewClient {
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
mHandler.post(new Runnable() {
public void run() {
if(!pgd.isShowing()){
pgd.show();
}
}
});
super.onPageStarted(view, url, favicon);
}
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
Log.i("url loaded", "url::: " + url);
view.loadUrl(url);
return true;
}
@Override
public void onPageFinished(WebView view, String url) {
mHandler.post(new Runnable() {
public void run() {
if(pgd !=null && pgd.isShowing()){
pgd.dismiss();
}
}
});
super.onPageFinished(view, url);
}
}
Any pointers will be highly appreciated. Thanks.