Note that there are some explanatory texts on larger screens.

plurals
  1. POAdding a Progress Dialog in a webview
    primarykey
    data
    text
    <p>I have been trying to incorporate a progress dialog into my app when pages are loading in the webview so there isn't just a blank white screen. I know this question is posted everywhere but I can't seem to figure out anything that works for me. I am new to programming and working with android so any information would be helpful. Below is the code that I currently have now. With the onPageStarted I am getting a compile error for Bitmap and I'm not sure what the problem is. Thanks.</p> <pre><code>public class Grades extends Activity{ @Override protected void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); //requesting system settings requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().requestFeature( Window.FEATURE_PROGRESS); WebView webview = new WebView(this); //web settings WebSettings webSettings = webview.getSettings(); webSettings.setJavaScriptEnabled(true); webSettings.setDisplayZoomControls(true); webSettings.setBuiltInZoomControls(true); setContentView(webview); //loads webpages in webview instead of launching browser webview.setWebViewClient(new WebViewClient() { ProgressDialog prDialog; @Override public void onPageStarted(WebView view, String url, Bitmap favicon) { prDialog = ProgressDialog.show(Grades.this, null, "loading, please wait..."); super.onPageStarted(view, url, favicon); } @Override public void onPageFinished(WebView view, String url) { prDialog.dismiss(); super.onPageFinished(view, url); } }); //loading webpage webview.loadUrl("page__link"); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload