I'm having a bit of an issue with calling restartLoader() from the outside of a ListFragment. The sequence goes according to Tap an "Add"-button which opens an Activity -> Enter data -> Tap Save, which starts an AsyncTask to store data on a server. Upon a successful data transfer, return to the previous Activity -> Have the Activity call a method in the ListFragment that runs getLoaderManager().restartLoader().
This, without fail, always creates a "java.lang.IllegalStateException: Fragment ListsFragment{42481238} not attached to Activity"-error. If I move the restartLoader() to onResume it works slightly better, but I have other buttons that directly modifies the data connected to the ListFragments, which still trigger an IllegalStateException no matter what.
Excerpt error message from logcat
E/AndroidRuntime(29594): java.lang.IllegalStateException: Fragment ListsFragment{42450b18} not attached to Activity
E/AndroidRuntime(29594): at android.support.v4.app.Fragment.getLoaderManager(Fragment.java:768)
E/AndroidRuntime(29594): at testpager.ListsFragment.resetList(ListsFragment.java:122)
What am I missing? How can I refresh a ListFragment from a FragmentActivity without triggering this exception?