I use a generic webview to load html files in order to show help dialogs in my android app.
this.helpView = new WebView(this);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
this.helpView.getSettings().setSafeBrowsingEnabled(false);
this.helpView.getSettings().setJavaScriptEnabled(true);
The usage is pretty simple, when i want to show any help dialog a load any of the html files, included into the assets folder, into the helpView
if (this.helpView.getParent() != null)
((ViewGroup) this.helpView.getParent()).removeView(this.helpView);
this.helpView.loadUrl(url);
where url is something like: file:///android_asset/add_giveaway_help.htm? + Locale.getDefault().getLanguage()
Here is the trick: I've only one html file for each help situation but each file includes the help text in several languages
each html file has a javascript function which reads the own url and check for the query parameter indicator of language.
according to this information some specific css class is injected into the html and only the desired language is shown
the javascript function is:
if(window.location.href.endsWith('pt'))
style.innerHTML = '.en { display: none; }';
else
style.innerHTML = '.pt { display: none; }';
however this is not working on android 16
both help texts are being shown... while other javascripts in the same html are working even on android 16