Code example for WebView

Methods: canGoBackclearCacheclearHistory

0
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        if(event.getAction() == KeyEvent.ACTION_DOWN){
            switch(keyCode)
            { 
            case KeyEvent.KEYCODE_BACK:
                if(webView.canGoBack() == true){
                        webView.goBack();
                }else if(isWebHistory && webView.canGoBack() == false){
                	isWebHistory = false;
                	Intent menu = new Intent(FacebookSlider.this, FacebookSlider.class);
        			startActivity(menu);
        			webView.clearHistory();
        			 
                }else{ 
                	webView.clearCache(true);
                	moveTaskToBack(true);
                    FacebookSlider.this.finish();
                } 
                return true; 
            }