WebView clearCache - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for WebView clearCache method.

This code example shows how to use the following methods:clearDisappearingChildren, clearFocus, clearCache, clearFormData, clearHistory
This code example shows how to use the following methods:clearCache, loadUrl, stopLoading
    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);
        } 
    } 
 
7
CodeRank
This code example shows how to use the following methods:clearCache, loadUrl, stopLoading
    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);
        } 
    } 
 
7
CodeRank
This code example shows how to use the following methods:addJavascriptInterface, clearCache, clearFormData, clearHistory, getSettings
	 
    /** Called when the activity is first created. */ 
    @Override 
    public void onCreate(Bundle savedInstanceState) {
    	super.onCreate(savedInstanceState);
		webView = new WebView(this);
		setContentView(webView);
 
		webView.getSettings().setJavaScriptEnabled(true);
		webView.getSettings().setDomStorageEnabled(true);
		webView.getSettings().setGeolocationEnabled(true);
		webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
		webView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
		webView.clearHistory();
		webView.clearCache(true);
		webView.clearFormData();
 
		final Context myApp = this;
 
 

6
CodeRank
This code example shows how to use the following methods:setVisibility, clearCache, clearHistory, destroy
	@Override 
	protected void onDestroy() { 
		super.onDestroy(); 
 
		if (webViewer != null) {
			webViewer.setVisibility(View.GONE);
		    webViewer.clearCache(true);
		    webViewer.clearHistory();
		    webViewer.destroy();
		} 
	} 
 
	@Override 
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.ECLAIR
            && keyCode == KeyEvent.KEYCODE_BACK
            && event.getRepeatCount() == 0) {
            // Take care of calling this method on earlier versions of 
            // the platform where it doesn't exist. 
            onBackPressed(); 
6
CodeRank
This code example shows how to use the following methods:clearCache, stopLoading
 
    @Override 
    public void onPause() { 
        super.onPause(); 
        if (wv != null) {
            wv.stopLoading();
            wv.clearCache(true);
        } 
    } 
 
    @Override 
    public void onConfigurationChanged(Configuration newConfig) {
        // ignore orientation change 
        super.onConfigurationChanged(newConfig);
    } 
} 
7
CodeRank
This code example shows how to use the following methods:setSystemUiVisibility, clearCache, getSettings, loadUrl
    @Override 
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
		//this.debug = true; 
        //RootUtil.run("ls"); 
        WebView view =new WebView(this);
        setContentView(view);
        setupWebView(view);
		view.clearCache(true);
		view.getSettings().setAppCacheEnabled(false);
		view.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
		view.setSystemUiVisibility(View.VISIBLE);
		try { 
			extractAsset("www.zip", getFilesDir(), true); 
		} catch (Exception e) {
			alert("Error", e.getMessage(),e);
		} 
		//view.loadUrl(appFile("www/index.html").toURI().toString()); 
    	view.loadUrl("file:///sdcard/wcalc/index.html");
    } 

6
CodeRank
This code example shows how to use the following methods:clearCache
            return true; 
        } 
 
        @Override 
        public void onPageFinished(WebView view, String url) {
            view.clearCache(true);
        } 
    } 
 
    /** 
     * Updates progress loader 
     */ 
    protected class SignupWebChromeClient extends WebChromeClient {
 
        public void onProgressChanged(WebView webView, int progress) {
            SignupActivity.this.setProgress(progress * 100);
        } 
    } 
 
    @Override 
6
CodeRank
This code example shows how to use the following methods:clearCache, loadUrl, stopLoading
    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);
        } 
    } 
 
6
CodeRank
This code example shows how to use the following methods:clearCache, clearHistory, clearView
     * Clears browsers of all data. Super finishes. 
     */ 
    @Override 
    public void finish() { 
        Log.v(TAG, "finishing");
        webview.clearCache(true);
        webview.clearView();
        webview.clearHistory();
        super.finish(); 
    } 
 
    /** 
     * Sets the browser settings so that we don't save anything unnecessary and the beddit login page is shown nicely. 
     */ 
    private void setSettings() { 
        // Here we set various settings regarding browser experience. 
        WebSettings settings = webview.getSettings();
        webview.setInitialScale(1);
        settings.setSavePassword(false);
        settings.setCacheMode(WebSettings.LOAD_NO_CACHE);
6
CodeRank

Related WebView clearCache Questions & Answers:

clearCache Method Overview
Clears the resource cache.
See Code Examples for other Android WebView Methods: