I use the following way. Only when there is first opened loading progress bar, but later opened URLs are not loaded. May I ask how you can make him every once opened will be loaded?
WebView web = null;
ProgressDialog dialog = null;
@ Override
public void onCreate (Bundle savedInstanceState) {
super.onCreate (savedInstanceState);
setContentView (R.layout.main);
web = (WebView) findViewById (R.id.webview1);
WebSettings webSettings = web.getSettings () ;/ / enable JavaScript
webSettings.setJavaScriptEnabled (true) ;/ / enable JavaScript
if (web! = null)
{
web.setWebViewClient (new WebViewClient ()
{
@ Override
public void onPageFinished (WebView view, String url)
{
dialog.dismiss ();
}
});
loadUrl ("http://wap.td776.com");
}
}
public void loadUrl (String url)
{
if (web! = null)
{
web.loadUrl (url);
dialog = ProgressDialog.show (this, null, "Loading, please wait ..");
web.reload ();
}
}
Effect!

Reply:
Try to rewrite shouldOverrideUrlLoading
Reply:
This question is very simple
You first create a web after the web object is not empty, of course, does not show up. .
Solution is very simple,
Rewrite onDestroy method
Each time you exit the web is set to air on the line.
In addition, you called loading bar progress bar's name is Akira who
Want to achieve progress bar, then you need to add
new WebChromeClient () object
Reply:
Above wrong. . .
This is a problem thread,
Landlord changed.
public void loadUrl (String url) {
if (web! = null) {
dialog = ProgressDialog.show (this, null, "Loading, please wait ..");
Log.e ("TEST", dialog.toString ());
web.loadUrl (url);
/ / Web.reload ();
}
}
On the line.
Reply:
The above method can achieve the requirements of the landlord, I realized the front also similar, but then my application error reporting in the background a lot of the machines will report 4.2 dialog wrong, so I learn from the experience of loading progress zaker written in html , of course, this is my mechanism
No comments:
Post a Comment