コード例 #1
0
    @Override
    protected Label doInBackground(LabelAddRequest... requests) {
      if (requests == null || requests.length != 1) {
        throw new IllegalArgumentException("Add task supports only single Label additions.");
      }

      mRequest = requests[0];
      LogUtils.log(
          this,
          Log.VERBOSE,
          "Spawning new LabelAddTask(%d) for %s",
          hashCode(),
          mRequest.getLabel());

      return mClient.insertLabel(mRequest.getLabel());
    }
コード例 #2
0
    @Override
    protected void onPostExecute(Label result) {
      LogUtils.log(
          this, Log.VERBOSE, "LabelAddTask(%d) complete, stored as %s", hashCode(), result);
      mRequest.invokeCallback(result);

      if (result != null) {
        sendCacheRefreshIntent(result.getPackageName());
      }

      super.onPostExecute(result);
    }