Context and Fragments on orientation change
<p>I'm using the Fragment compatibility package.</p>

<p>In my Fragment in onAttach, I keep a <code>Context</code> reference.</p>

<pre><code>public void onAttach(Activity activity) {
    super.onAttach(activity);
    Log.w(logTag, "Activity is: " + activity);
    mContext = activity;
    Log.w(logTag, "mContext is: " + mContext); // &lt;-- Breakpoint here
}
</code></pre>

<p>later on, I use the context</p>

<pre><code>private String loadExampleSuccessXML () {
    try {
        AssetManager assets = this.mContext.getAssets(); // &lt;-- Breakpoint here
        //Other Stuff
</code></pre>

<p>When I change orientation, onAttach seems to store the new Context but when I get to <code>loadExampleSuccessXML</code>, <code>mContext</code> is null.</p>

<p>I have breakpoints after <code>mContext</code> has been saved in onAttach, and at <code>mContext.getAsssets()</code>.</p>

<p>When I first run the app the debugger shows the value of mContext:</p>

<p>In <code>onAttach(), mContext [MyActivity] (id=830010419632)</code></p>

<p>In <code>loadExampleSuccessXML(), mContext   [MyActivity]  (id=830010419632)</code></p>

<p>But then after a config change</p>

<p>In <code>onAttach(), mContext    [MyActivity]  (id=830010565472)</code></p>

<p>In <code>loadExampleSuccessXML(), mContext   null</code></p>

<p>I can't understand why. Any help would be great.</p>
