I have an object which make some http requests in a separate thread to a server. When the response is returned, I call an listener which let my activity know that the operation was finished.
The problem is: if the thread is running and the activity was paused I get android.view.WindowManager$BadTokenException: Unable to add window -- token android.os.BinderProxy@4069ef80 is not valid; is your activity running? error.
Is it possible to detect if the activity was paused? Thank you.
Yes see here. Just override the onPause in your activity