Note that there are some explanatory texts on larger screens.

plurals
  1. POWebsite wrapped in App - Loading
    text
    copied!<p>I'm working on an Android App that simply wraps a mobile version of a website inside of a native App container.</p> <p>At present I call (example):</p> <pre><code> wv.loadUrl("http://www.websitehere.com/"); </code></pre> <p>I have exported the entire project and tested it on my phone and when loading a new page inside of the App it takes a few moments, however not being on a browser there is no loading indicator, so it is a still screen on the current page for a few moments (depending on internet speed) while the new page loads.</p> <p>What would be the best way to implement a loading indicator so that the user knows that a new page is infact loading?</p> <p>EDIT: Loading added, but only for the initial pageload of app.</p> <pre><code> public class Main extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); final ProgressDialog pd = ProgressDialog.show(this, "Page is", "Loading...",true); WebView wv = (WebView)findViewById(R.id.my_webview); wv.setWebViewClient(new WebViewClient() { @Override public void onPageFinished(WebView view, String url) { if(pd.isShowing()&amp;&amp;pd!=null); { pd.dismiss(); } } @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { pd = ProgressDialog.show(this, "Page is", "Loading...", true); view.loadUrl(url); return true; } }); wv.loadUrl("http://www.websitehere.com"); } } </code></pre>
 

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