Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Navigate into webview

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 284
    Comment on it

    Sometime it is required to navigate user in webview on back press button rather than to exit webview so for this you can use the following code :

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        if(event.getAction() == KeyEvent.ACTIONDOWN){
            switch(keyCode)
            {
                case KeyEvent.KEYCODEBACK:
                        if (mWebView.canGoBack()) {
                            mWebView.goBack();
                        } else {
                            cancel();
                        }
    
                    return true;
            }
    
        }
        return super.onKeyDown(keyCode, event);
    }
    

    here you can set some properties on webview like this :

    mWebView.getSettings().setJavaScriptEnabled(true);
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: