I have this code with Loading webview, which uses the properties of Google Chrome.
The problem is that the emulator the webview loads a url containing html5 and it works perfect but on a android device using the properties of the default browser and html5 obviously does not work the url.
How i can to the webview in android device to use the properties of the Google Chrome browser and not the default browser?
Any help?
Thank you
public View onCreateView(LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) {
// Capturo las variables que dejo en memoria, nombre y email
SharedPreferences sp1 = PreferenceManager.getDefaultSharedPreferences(getActivity().getApplicationContext());
emailAdd = sp1.getString("EMAILADDRESS", "");
name = sp1.getString("NAME", "");
//-----------------------------------------------
View x = inflater.inflate(R.layout.patrocinadores, container, false);
String url = "http://xxxx.co/xxxx/xxxx.php?email="+ emailAdd + "";
mWebView = (WebView) x.findViewById(R.id.webView1);
// Para colocar un loading
pd = ProgressDialog.show(getActivity(), "", "Loading...",true);
//--------------------------
if(mWebView != null){
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
mWebView.getSettings().setAppCacheEnabled(false);
mWebView.getSettings().setAllowFileAccess(true);
mWebView.getSettings().setAllowContentAccess(true);
mWebView.loadUrl(url);
mWebView.setWebChromeClient(new WebChromeClient());
mWebView.setWebViewClient(new WebViewClient() {
// Coloca un loading mientras se carga el webview y se quita cuando se carga la pagina
public void onPageFinished(WebView view, String url) {
if(pd.isShowing()&&pd!=null)
{
pd.dismiss();
}
}
//-----------------------------------------------
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
});
}
return x;
}