2
  1. I load HTML data into WebView with loadDataWithBaseURL
  2. Do it one more time
  3. Execute the following code and instead of going back to the 1st page - whole app exits. What am I doing wrong here?

    public boolean onKeyDown(final int keyCode, final KeyEvent event) {
    if (keyCode == KeyEvent.KEYCODE_BACK && this.browser.canGoBack()) {
        this.browser.goBack();
        return true;
    }
    return super.onKeyDown(keyCode, event);
    

    }

Also - is it possible for WebView cache to survive Activity#onStop? Basically - if I close app and reopen - I want WebView to display last data that was loaded, currently - I'll get a blank screen and then have to reload same data again

1 Answer 1

1

The problem is that load* does not create a new WebView, nor does it do anything special like create a history record, unfortunately.

You probably want call startActivity() and invoke a second activity for the second set of data.

Sign up to request clarification or add additional context in comments.

1 Comment

My WebView is embedded into single activity, I guess I will have to monkey with history

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.