For simplicity sake let’s say I have 1 activity that has a few textViews a progressSpinner and a webView.
The webView visibility is set to “gone” all others are set to visible. When the page finishes loading and the 2 divs I want to remove are hidden, I want to hide all visible items and show the fully loaded webView.
However when I run it I see all the visible items and the webView is not showing at this point(which is good). After a few seconds the visible items are gone and a blank webView appears(shouldn’t happen), then the page loads, then the 2 divs are hidden.
I want to hide this from the user how can I set it to display the webView only after the page is completely done loading and the 2 divs are hidden?
public void onPageFinished(WebView view, String url) {
webview.loadUrl("javascript:$('#MainMenu').hide()");
webview.loadUrl("javascript:$('#EmployeeDashboard').hide()");
android.os.SystemClock.sleep(2500); // My attempt to allow the divs to be hidden before it's displayed to the user
findViewById(R.id.progressSpinner).setVisibility(View.GONE);
findViewById(R.id.imageView1).setVisibility(View.GONE);
findViewById(R.id.textView1).setVisibility(View.GONE);
findViewById(R.id.textView2).setVisibility(View.GONE);
findViewById(R.id.tvLoading).setVisibility(View.GONE);
findViewById(R.id.webview).setVisibility(View.VISIBLE);
}
In the xml I have:
<WebView
android:id="@+id/webview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:visibility="gone" />