This call, which occurs in a Fragment, occasionally crashes due to a NullPointerException, especially when the app is not running in the foreground:
getActivity().getApplication());
This call occurs when feedback comes back from the server or when there’s a need to redraw the fragment. I’m not sure why that call would throw a NPE, can the fragment remain in memory while the Activity gets GCed?
If it makes a difference, I’m using a SwipeyTab ViewPager to display different fragments.
The issue was there was a long running thread on the Fragment, which returned results after the Fragment was deattached from the Activity. It seems strange for the Fragment to exist without being attached to an Activity (after it was already attached).