How do I prevent the reload of an Android WebView during an orientation change (nested fragments)?
<p>I know there are a lot of questions like this that have been asked but I seem to have a specific situation that hasn't been covered in any of the duplicate questions.</p>

<p>So I'll start by informing you of my situation. I have an Activity which holds a fragment which holds another fragment (WebViewFragment). So I have a nested fragment. The WebView is a <a href="https://github.com/cprcrack/VideoEnabledWebView" rel="nofollow">VideoEnabledWebView</a>. I'm using this because I have videos inside the html5 inside the WebView which I want to be able to show in fullscreen. The problem is: when you have a video in fullscreen, and then change the orientation of the device, the Activity is restarted and so the WebView reloads causing the video to close. I then have to restart the video from the beginning to play it in the new orientation. I want to be able to change the orientation of the device without interrupting the video. So the video stays fullscreen and continues where it left off.</p>

<p>According to the Android documentation, there are two ways to go about dealing with an orientation change:</p>

<ol>
<li><strong>Handling the Configuration Change Yourself</strong></li>
</ol>

<p>This is the most popular solution to this question on stack overflow. In which I plug android:configChanges="keyboardHidden|orientation|screenSize" into my activity in the manifest. This works but I can't use it because it prevents the entire Activity from restarting. Therefore, if I'm in portrait mode, my landscape specific layout xml files don't get loaded. Maybe there is a way to reload the layout files? But this all sounds hacky and I'm not sure what other stuff I need to take care of manually which is usually done automatically by the Android OS during a config change.</p>

<ol start="2">
<li><strong>Retain an object during a configuration change.</strong></li>
</ol>

<p>This is not possible for me because you have to use setRetainInstance(true) and you can't do this with child fragments. But, does anyone know if this will work if I call setRetainInstance(true) on the parent fragment? I'm currently testing this but it is taking me a few hours to implement (since I'm kinda new to android). Before I waste anymore time attempting a possibly bad solution, can anyone verify whether or not this will work? In the meantime, I will continue to work on this and let you know if it does work when I'm done.</p>

<p>Thanks!</p>