In an android app, I have used a webView for the user to enter a "player" that consists of showing content from social networks in a presentation manner. However, it seems that this page is too "heavy" because it does not load well at all. Is there anything I can do to make this content load correctly or is there no other way to correct the problem than leaving the webView and entering the browser?
(Code used for the WebView:)
* Método para la creación de la WebView, en la que se mostrará el enlace en el que el usuario deberá introducir el ID
*/
public void CrearWeb ()
{
web=(WebView)findViewById(R.id.webV);
//Habilitar JavaScript
web.getSettings().setJavaScriptEnabled(true);
web.loadUrl(etiqueta);
}
/**
* Método para abrir el player sin salir de la aplicación
*/
public void Seguirweb ()
{
web.setWebViewClient(new WebViewClient()
{
public boolean shouldOverrideUrlLoading(WebView view, String url)
{
view.loadUrl(url);
return super.shouldOverrideUrlLoading(view, url);
}
});
web.setOnKeyListener(new View.OnKeyListener() {
@Override
public boolean onKey(View v, int keyCode, KeyEvent event)
{
if (event.getAction() == KeyEvent.ACTION_DOWN) {
switch (keyCode) {
case KeyEvent.KEYCODE_BACK:
if (web.canGoBack())
{
web.goBack();
return true;
}
break;
}
}
return false;
}
});
}
UPDATE: Comment that this problem is linked to the Android version since in versions higher than 6.0 it works correctly.