Android App crashing on changing the font size
<p>I have my app having view pager and fragments.
In my parent parent fragment I have made <code>setRetainInstance(true)</code>.</p>

<p>I put my app in background and change the font size. When I open my app again, it crashes.</p>

<pre><code>Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'int java.util.ArrayList.size()' on a null object reference
at android.support.v4.app.FragmentManagerImpl.getFragment(FragmentManager.java:667)
</code></pre>

<p>I cannot use <code>setRetainInstance(false)</code>. As I need to retain the state. How do I fix it?</p>