Code example for WebView: Displaying web pages

Methods: clearCacheloadUrlstopLoading

0
 
    private void navigate(String url, int timeout) {
        if(url == null) {
            Log.v(LOGTAG, "URL is null, cancelling...");
            finish();
        } 
        webView.stopLoading();
        if(logTime) {
            webView.clearCache(true);
        } 
        startTime = System.currentTimeMillis();
        Log.v(LOGTAG, "Navigating to URL: " + url);
        webView.loadUrl(url);
 
        if(timeout != 0) {
            //set a timer with specified timeout (in ms) 
            handler.sendMessageDelayed(handler.obtainMessage(MSG_TIMEOUT),
                    timeout);
        } 
    }