I read some threads regarding this issue (this, this, this), with no solution for my problem.
This is fairly a simple WebView component that load a JSON data in a html template. The unique case might be that it is a tab fragment component inside an activity.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusableInTouchMode="true">
<WebView
android:id="@+id/webView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone" />
<view.BKProgressBar
android:id="@+id/progressBar"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true" />
</RelativeLayout>
This is the Java code:
webView = view.findViewById(R.id.webView);
progressBar = view.findViewById(R.id.progressBar);
webView.getSettings().setJavaScriptEnabled(true);
webView.setVerticalScrollBarEnabled(true);
webView.setWebViewClient(new WebViewClient() {
public void onPageFinished(WebView view, String url) {
webView.setVisibility(View.VISIBLE);
progressBar.setVisibility(View.GONE);
}
});
progressBar.setVisibility(View.GONE);
webView.setVisibility(View.VISIBLE);
webView.addJavascriptInterface(new WebAppInterface(getActivity()), "AndroidNativeWrapper");
reloadJSON();
The device is Huawei model ATU-L21 running Android 8. Does anybody have the same problem?