i have an activities that host fragments. pressing a button goes from fragment A to fragment B through a FragmentTransaction and the added to the back stack. Now fragment B
AsyncTaskRunner doAsynchronousTask; //Before onCreateView //in onCreateView() doAsynchronousTask = new AsyncTaskRunner();`` doAsynchronousTask.execute(); // after onCreateView() @Override public void onStop() { super.onStop(); doAsynchronousTask.cancel(true); }