Has anything changed in the implementation of WebView, WebViewClient for Android 7?
I have some html files in a subfolder inside the Assets folder. The list.html file, which contains other links that call other html files that are in the same folder, is normally displayed but when I click the links to call the other html files are not appearing in WebView.
I tested on android 4 and 6 and it works perfectly, android 7 does not work.
Follow the code:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.help);
myWebView = (WebView) findViewById(R.id.webViewHelp);
progressBar = (ProgressBar) findViewById(R.id.progressBar);
myWebView.setWebViewClient(new ActivityHelp.myWebClient());
myWebView.getSettings().setJavaScriptEnabled(true);
myWebView.getSettings().setBuiltInZoomControls(true);
myWebView.getSettings().setDisplayZoomControls(false);
myWebView.getSettings().setSupportZoom(true);
myWebView.loadUrl("file:///android_asset/help/lista.html");
}
public class myWebClient extends WebViewClient
{
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
// TODO Auto-generated method stub
super.onPageStarted(view, url, favicon);
progressBar.setVisibility(View.VISIBLE);
}
@Override
public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
super.shouldOverrideUrlLoading(view, request);
progressBar.setVisibility(View.VISIBLE);
return true;
}
@Override
public void onPageFinished(WebView view, String url) {
// TODO Auto-generated method stub
super.onPageFinished(view, url);
progressBar.setVisibility(View.INVISIBLE);
}
}