stephanenicolas / robospice

Repo of the Open Source Android library : RoboSpice. RoboSpice is a modular android library that makes writing asynchronous long running tasks easy. It is specialized in network requests, supports caching and offers REST requests out-of-the box using extension modules.
Apache License 2.0
2.95k stars 545 forks source link

Getting a Callback after Fragment has been detached #449

Open akshaydewan opened 8 years ago

akshaydewan commented 8 years ago

Hi,

We're using robospice-spring-android version 1.4.11 on a project. We're seeing that we sometimes get a network callback on a detached Fragment, which leads to a NullPointerException in the code. As suggested in the Wiki, we have tied the SpiceManger to the Fragment lifecycle and not the Activity lifecycle.

This problem is very hard to reproduce and happens very rarely. Our hunch is that it may be due to a race condition in the framework, but we haven't been able to narrow it down.

As a workaround, we are checking for Fragment.isAdded() in our callbacks.

Has anyone faced a similar issue?