@Override public void execute() { tabActivity.setProgressVisible(true); new Thread() { @Override public void run() { try { final T result = doInBackground(); if (isCancelled()) { return; } getHandler() .post( new Runnable() { @Override public void run() { tabActivity.setProgressVisible(false); done(result); } }); } catch (final Throwable t) { if (isCancelled()) { return; } getHandler() .post( new Runnable() { @Override public void run() { tabActivity.setProgressVisible(false); // tabActivity.logout(); error(t); } }); } } }.start(); }
private boolean isCancelled() { return tabActivity.isDestroyed(); }