2

I have a really heavy loading WebView in a Fragment.

The WebView takes about 2-4 seconds to load the url.

Every time the orientation is changed the WebView reloads the Url and it is a really bad user experience.

Is there a way to leave the url/WevView alive when the orientation changes?

Thanks


I forgot to add i cant add orientation to the manifest because of how the app is built.

 android:configChanges="orientation|screenSize">

So answers i found don't help me in my case.

ilan
  • 4,402
  • 6
  • 40
  • 76
  • This is one of those cases where [`android:configChanges` in the manifest](https://developer.android.com/guide/topics/manifest/activity-element#config) may be appropriate, to avoid the destroy/recreate cycle for common configuration changes. Make sure that you are still using a `ViewModel` or something to deal with those configuration changes that you do not address via `android:configChanges`. – CommonsWare Apr 13 '19 at 20:08
  • 2
    Possible duplicate of [Android - Preventing WebView reload on Rotate](https://stackoverflow.com/questions/12131025/android-preventing-webview-reload-on-rotate) – Philio Apr 13 '19 at 20:08
  • @Philio see my edit – ilan Apr 13 '19 at 20:15

0 Answers0