How not to reload webview on screen rotation?

Viewed 80

I have a webview which loads content from URL. However, the webview reloads the content on screen rotation, which I would like to avoid.

I have checked similar questions on SO which all recommended either:

  1. Putting orientation into android:configChanges="orientation..." which is generally discouraged and I don't want to use it

  2. Or saving the webview's state with webView.saveState(outState)


As for the 2nd option, the documentation now states:

Please note that this method no longer stores the display data for this WebView. The previous behavior could potentially leak files if restoreState(Bundle) was never called.

Which means that it's not the solution either. Is it possible to solve this?

0 Answers
Related