コード例 #1
0
  @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();
  }
コード例 #2
0
 private boolean isCancelled() {
   return tabActivity.isDestroyed();
 }