I've and web app which uses Web view to load the HTML content. I'm developing it for Google TV, The web page having an video in it , So my problem is when i click to play an video it opens in another page not in same webview and it happens for Google TV( Logitech ) not for Mobile device.
What is wrong with it.
My code is:
webView = (WebView) findViewById(R.id.webview);
WebSettings settings = webView.getSettings();
//settings.setJavaScriptEnabled(true);
settings.setAllowFileAccess(true);
if (Build.VERSION.SDK_INT > 7) {
settings.setPluginState(PluginState.ON);
} else {
settings.setPluginsEnabled(true);
}
webView.setWebChromeClient(new SimpleWebChromeClient());
settings.setJavaScriptEnabled(true);
settings.setUserAgentString("Mozilla/5.0 (X11; Linux armv7l) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.77 Large Screen Safari/534.24 GoogleTV/000000");
settings.setBuiltInZoomControls(true);
settings.setSupportZoom(true);
settings.setPluginsEnabled(true);
settings.setLoadWithOverviewMode(true);
settings.setUseWideViewPort(true);
webView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
webView.setScrollbarFadingEnabled(false);
String fileName = "html_content/test.html";
webView.loadUrl("file:///android_asset/" + fileName);
The WebChromeClient code is:
private class SimpleWebChromeClient extends WebChromeClient {
/* (non-Javadoc)
* @see android.webkit.WebChromeClient#onShowCustomView(android.view.View, android.webkit.WebChromeClient.CustomViewCallback)
*/
@Override
public void onShowCustomView(View view, CustomViewCallback callback) {
super.onShowCustomView(view, callback);
//Log.w(RedditTVHDActivity.LOG_PREFIX, "In OnShowCustomView");
}
}