0
我想停止加載網址的webview,當它以google.com開頭並從示例返回到默認頁面時[1]。頁]。停止加載webview並返回到上一頁
在我的webview客戶端下面它不會返回到第一頁thougth應該重寫方法的條件是好的。
public class myWebClient extends WebViewClient
{
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
// TODO Auto-generated method stub
super.onPageStarted(view, url, favicon);
// view.setVisibility(View.GONE);
rlChargement.setVisibility(View.VISIBLE);
progresswheel.spin();
}
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
// TODO Auto-generated method stub
// view.setVisibility(View.GONE);
System.out.println("BROWSER URL : "+url);
//Recherche sans filtre
if (url.equalsIgnoreCase("http://www.google.com")){
System.out.println("INVALID");
web.clearCache(true);
ActToast.message="error message";
startActivity(new Intent(me, ActToast.class));
rlChargement.setVisibility(View.GONE);
progresswheel.stopSpinning();
view.stopLoading();
web.clearHistory();
}
view.loadUrl(url);
return true;
}
@Override
public void onPageFinished(WebView view, String url) {
// TODO Auto-generated method stub
super.onPageFinished(view, url);
// animate(view);
// view.setVisibility(View.VISIBLE);
rlChargement.setVisibility(View.GONE);
progresswheel.stopSpinning();
}
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
web.loadUrl("file:///android_asset/onreceivingerror.html");
}
}