Note that there are some explanatory texts on larger screens.

plurals
  1. POFragmentActivity is lost after app is paused for a while
    primarykey
    data
    text
    <p>I am experiencing some weird behavior with an android app I have been working on, here is what happens:</p> <ol> <li>I use the app for a while, works fine without problems</li> <li>I "pause" the app by clicking on the android home button</li> <li>I use some other apps on the phone for a few mins</li> <li>I go back to my app and it seems like its in a very weird state, the FragmentActivity is lost, but the Fragment that was being displayed last it still shown. When i do a call "getActivity()" from the Fragment it returns null which causes problems (because i need a reference back to the FragmentActivity.</li> </ol> <p>Any idea why the FragmentActivity is lost after the app is paused after a while, i assume its some sort of garbage collection issue, but normally wouldn't the whole app be destroyed not just the FragmentActivity?</p> <p>Some things to note:</p> <ol> <li>I am using the compatibility library</li> <li>I am using viewpage indicator (but i dont see this as being anything to do with the issue) - <a href="https://github.com/JakeWharton/Android-ViewPagerIndicator" rel="nofollow">https://github.com/JakeWharton/Android-ViewPagerIndicator</a></li> </ol> <p>Note: i can also reproduce this problem easily when i remove my <code>android:configChanges="orientation|keyboardHidden|screenSize"</code> from the activity element in the manifest and do a orientation change. So i assume its not maintaining state of the views after activity recreation. <code>onSaveInstanceState</code> and <code>onRestoreInstanceState</code> are called ok, and <code>setRetainInstance(true);</code> is set on the fragment so im not sure why this is happening.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload