4

Scope

Have to handle orientation changes for WebView.

Problem

saveState/restoreState doesn't work for WebView when using custom WebViewClient (blank page is shown).

Code snippet

    setContentView(R.layout.webview);

    // load OAuth url in WebView
    mWebView = (WebView) findViewById(R.id.webview);
    if (savedInstanceState == null) {
        mWebView.getSettings().setJavaScriptEnabled(true);
        mWebView.setWebViewClient(new SimpleWebViewClient());
        mWebView.loadUrl(Consts.URL_AUTHORIZATION_OAUTH);
    } else {
        mWebView.restoreState(savedInstanceState);
    }

P.S.

Commenting out mWebView.setWebViewClient(new SimpleWebViewClient()); helps but I have to use my SimpleWebViewClient which wathces for onPageFinished during OAuth process.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.