Tuesday, January 28, 2014

When the page is loaded WebView period of time to wait for how to deal with a black screen?


            
I use WebView to display a web page, but when loaded question because of the speed, the process reads the page is blank for some time, but this time is not short for several seconds. The time to ask how to deal with this black screen? There is a black screen time very hard to accept!
Reply:
Loading ......
Reply:
cited a floor reply:
Loading ......

Let me know when loading, the key is how to get loading?
Reply:
ProgressDialog
Reply:
I mean, let the user know the program Loading, no matter what method you use
Reply:
reference to the third floor of the reply:
ProgressDialog

+
dialog = new ProgressDialog (this);
dialog.setMessage (prompt text);
dialog.setCancelable (true);
dialog.show () ;/ / start circling
new Thread (new Runnable () {
@ Override
public void run () {
/ / Operation
/ / Close operation finished circling
dialog.dismiss ();
}
.}) Start ();
Reply:
 
mWebView = (WebView) findViewById (R.id.WebView01);
/ / Method to perform the page to be loaded webview this setting performed
mWebView.setWebViewClient (new WebViewClient () {
/ / Open a new page with your own definition webview to display, not the system comes with a browser to display
public boolean shouldOverrideUrlLoading (WebView view, String url) {
/ / TODO Auto-generated method stub
/ / When a new connection with the current webview display
view.loadUrl (url);
return super.shouldOverrideUrlLoading (view, url);
}
/ / Start loading the web page to be done
public void onPageStarted (WebView view, String url, Bitmap favicon) {
super.onPageStarted (view, url, favicon);
}
/ / Load the completion of work to be done
public void onPageFinished (WebView view, String url) {
super.onPageFinished (view, url);
}
/ / Error when loading the work to be done
public void onReceivedError (WebView view, int errorCode,
String description, String failingUrl) {
Log.d (TAG, "error =" + description);
Toast.makeText (TestWebviewDemo.this,
errorCode + "/" + description, Toast.LENGTH_LONG)
. Show ();
}
});

In the middle of the appropriate method inside loading
Reply:
Give it a friendly little loading animation
Reply:
references 6th Floor reply:
Java code

mWebView = (WebView) findViewById (R.id.WebView01);
/ / Method to perform the page to be loaded webview this setting performed
mWebView.setWebViewClient (new WebViewClient () {
/ / Open a new page with your own definition webview to display, not the system comes with a browser to display
public boolean ......

Thanks in the shoes, but public void onPageStarted (WebView view, String url, Bitmap favicon) This method Bitmap Bitmap favicon inside my program this parameter being given that the type can not be resolved, who knows what reason?
Reply:
Would not it? I usually do not deal with this method onPageStarted parameters directly loading a loading, then switch off the page has finished loading loading.
Reply:
If you want to know more webview operation, in the following information in detail there
http://download.csdn.net/detail/fire_fire_fire/4311279
Reply:
Thank you
Reply:
I have also this problem, you solve the problem yet
Reply:
Need your reply

No comments:

Post a Comment