2010-08-26 72 views

回答

4

onLoadResource()在調用任何資源(包括JavaScript)時被調用。目的與shouldOverrideUrlLoading()有點不同。

webControls.setWebViewClient(new WebViewClient() { 
    //Notify the host application that the WebView will load 
    //the resource specified by the given url. 
    @Override 
    public void onLoadResource (WebView view, String url) { 
     super.onLoadResource(view, url); 
     Log.v(TAG, "onLoadResource("+url+");"); 
    } 

    //Give the host application a chance to take over the 
    //control when a new url is about to be loaded in the 
    //current WebView. 
    @Override 
    public void shouldOverrideUrlLoading(WebView view, String url) { 
     super.shouldOverrideUrlLoading(view, url); 
     Log.v(TAG, "shouldOverrideUrlLoading("+url+");"); 
    } 
} 
相關問題