android.content.AsyncTaskLoader.deliverResult()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(7.3k)|赞(0)|评价(0)|浏览(109)

本文整理了Java中android.content.AsyncTaskLoader.deliverResult()方法的一些代码示例,展示了AsyncTaskLoader.deliverResult()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AsyncTaskLoader.deliverResult()方法的具体详情如下:
包路径:android.content.AsyncTaskLoader
类名称:AsyncTaskLoader
方法名:deliverResult

AsyncTaskLoader.deliverResult介绍

暂无

代码示例

代码示例来源:origin: yahoo/squidb

@Override
public void deliverResult(SquidCursor<T> data) {
  if (isReset()) {
    if (data != null) {
      data.close();
    }
    return;
  }
  SquidCursor<T> oldCursor = this.cursor;
  this.cursor = data;
  if (isStarted()) {
    super.deliverResult(data);
  }
  if (oldCursor != null && oldCursor != data && !oldCursor.isClosed()) {
    oldCursor.close();
  }
}

代码示例来源:origin: vbier/habpanelviewer

@Override
public void deliverResult(List<String> data) {
  mData = data;
  super.deliverResult(data);
}

代码示例来源:origin: dicodingacademy/a14-made-labs1

@Override
public void deliverResult(final ArrayList<WeatherItems> data) {
  mData = data;
  mHasResult = true;
  super.deliverResult(data);
}

代码示例来源:origin: jclehner/rxdroid

@Override
public void deliverResult(List<? extends ItemHolder<T>> data)
{
  mData = data;
  if(isStarted())
    super.deliverResult(data);
}

代码示例来源:origin: com.codeslap/groundy

@Override
public void deliverResult(List<T> list) {
  if (isReset()) {
    // An async query came in while the loader is stopped
    if (list != null) {
      list.clear();
    }
    return;
  }
  List<T> oldList = mList;
  mList = list;
  if (isStarted()) {
    super.deliverResult(list);
  }
  if (oldList != null && oldList != list && oldList.size() > 0) {
    oldList.clear();
  }
}

代码示例来源:origin: com.j256.ormlite/ormlite-android

@Override
public void deliverResult(List<T> results) {
  if (!isReset() && isStarted()) {
    super.deliverResult(results);
  }
}

代码示例来源:origin: geniusgithub/AndroidDialer

@Override
public void deliverResult(AccountSet cursor) {
  if (isReset()) {
    return;
  }
  mAccountSet = cursor;
  if (isStarted()) {
    super.deliverResult(cursor);
  }
}

代码示例来源:origin: com.j256.ormlite/ormlite-android

@Override
public void deliverResult(Cursor newCursor) {
  if (isReset()) {
    // an async query came in while the loader is stopped
    if (newCursor != null) {
      newCursor.close();
    }
    return;
  }
  Cursor oldCursor = cursor;
  cursor = newCursor;
  if (isStarted()) {
    super.deliverResult(newCursor);
  }
  // close the old cursor if necessary
  if (oldCursor != null && oldCursor != newCursor && !oldCursor.isClosed()) {
    oldCursor.close();
  }
}

代码示例来源:origin: AndroidHardening/PdfViewer

@Override
public void deliverResult(List<CharSequence> properties) {
  if (isReset()) {
    onReleaseResources();
  } else if (isStarted()) {
    super.deliverResult(properties);
  }
}

代码示例来源:origin: sylvek/itracing2

/**
 * Runs on the UI thread, routing the results from the
 * background thread to whatever is using the Cursor
 * (e.g., a CursorAdapter).
 */
@Override
public void deliverResult(Cursor cursor)
{
  if (isReset()) {
    // An async query came in while the loader is stopped
    if (cursor != null) {
      cursor.close();
    }
    return;
  }
  Cursor oldCursor = lastCursor;
  lastCursor = cursor;
  if (isStarted()) {
    super.deliverResult(cursor);
  }
  if (oldCursor != null && oldCursor != cursor && !oldCursor.isClosed()) {
    oldCursor.close();
  }
}

代码示例来源:origin: com.albedinsky.android/database

/**
 */
@Override
public void deliverResult(D data) {
  if (isReset()) {
    this.releaseResult(data);
    return;
  }
  final D oldResult = this.mData;
  this.mData = data;
  if (isStarted()) {
    super.deliverResult(data);
  }
  if (oldResult != null && oldResult != data) {
    this.releaseResult(oldResult);
  }
}

代码示例来源:origin: qiubiteme/android_api_demos

/**
 * Called when there is new data to deliver to the client.  The
 * super class will take care of delivering it; the implementation
 * here just adds a little more logic.
 */
@Override public void deliverResult(List<AppEntry> apps) {
  if (isReset()) {
    // An async query came in while the loader is stopped.  We
    // don't need the result.
    if (apps != null) {
      onReleaseResources(apps);
    }
  }
  List<AppEntry> oldApps = mApps;
  mApps = apps;
  if (isStarted()) {
    // If the Loader is currently started, we can immediately
    // deliver its results.
    super.deliverResult(apps);
  }
  // At this point we can release the resources associated with
  // 'oldApps' if needed; now that the new result is delivered we
  // know that it is no longer in use.
  if (oldApps != null) {
    onReleaseResources(oldApps);
  }
}

代码示例来源:origin: li2/learning-android-open-source

/**
 * Called when there is new data to deliver to the client.  The
 * super class will take care of delivering it; the implementation
 * here just adds a little more logic.
 */
@Override public void deliverResult(List<AppEntry> apps) {
  if (isReset()) {
    // An async query came in while the loader is stopped.  We
    // don't need the result.
    if (apps != null) {
      onReleaseResources(apps);
    }
  }
  List<AppEntry> oldApps = mApps;
  mApps = apps;
  if (isStarted()) {
    // If the Loader is currently started, we can immediately
    // deliver its results.
    super.deliverResult(apps);
  }
  // At this point we can release the resources associated with
  // 'oldApps' if needed; now that the new result is delivered we
  // know that it is no longer in use.
  if (oldApps != null) {
    onReleaseResources(oldApps);
  }
}

代码示例来源:origin: gearvrf/GearVRf-Demos

/**
 * Called when there is new data to deliver to the client.  The
 * super class will take care of delivering it; the implementation
 * here just adds a little more logic.
 */
@Override
public void deliverResult(T data) {
  if (isReset()) {
    // An async query came in while the loader is stopped.  We
    // don't need the result.
    if (data != null) {
      onReleaseResources(data);
    }
  }
  T oldData = mData;
  mData = data;
  if (isStarted()) {
    // If the Loader is currently started, we can immediately
    // deliver its results.
    super.deliverResult(data);
  }
  // At this point we can release the resources associated with
  // 'oldData' if needed; now that the new result is delivered we
  // know that it is no longer in use.
  if (oldData != null) {
    onReleaseResources(oldData);
  }
}

代码示例来源:origin: ashishbhandari/RetailStore

/**
 * Called when there is new data to deliver to the client. The super class will take care of
 * delivering it; the implementation here just adds a little more logic.
 */
@Override
public void deliverResult(List<Category> apps) {
  if (isReset()) {
    // An async query came in while the loader is stopped. We
    // don't need the result.
    if (apps != null) {
      onReleaseResources(apps);
    }
  }
  List<Category> oldApps = apps;
  mApps = apps;
  if (isStarted()) {
    // If the Loader is currently started, we can immediately
    // deliver its results.
    super.deliverResult(apps);
  }
  // At this point we can release the resources associated with
  // 'oldApps' if needed; now that the new result is delivered we
  // know that it is no longer in use.
  if (oldApps != null) {
    onReleaseResources(oldApps);
  }
}

代码示例来源:origin: geniusgithub/AndroidDialer

@Override
public void deliverResult(Cursor cursor) {
  if (isReset()) {
    /** The Loader has been reset; ignore the result and invalidate the data. */
    releaseResources(cursor);
    return;
  }
  /** Hold a reference to the old data so it doesn't get garbage collected. */
  Cursor oldCursor = mCursor;
  mCursor = cursor;
  if (mObserver == null) {
    mObserver = new ForceLoadContentObserver();
    mContext.getContentResolver().registerContentObserver(
        DialerDatabaseHelper.SMART_DIAL_UPDATED_URI, true, mObserver);
  }
  if (isStarted()) {
    /** If the Loader is in a started state, deliver the results to the client. */
    super.deliverResult(cursor);
  }
  /** Invalidate the old data as we don't need it any more. */
  if (oldCursor != null && oldCursor != cursor) {
    releaseResources(oldCursor);
  }
}

代码示例来源:origin: geniusgithub/AndroidDialer

@Override
public void deliverResult(Contact result) {
  unregisterObserver();
  // The creator isn't interested in any further updates
  if (isReset() || result == null) {
    return;
  }
  mContact = result;
  if (result.isLoaded()) {
    mLookupUri = result.getLookupUri();
    if (!result.isDirectoryEntry()) {
      Log.i(TAG, "Registering content observer for " + mLookupUri);
      if (mObserver == null) {
        mObserver = new ForceLoadContentObserver();
      }
      getContext().getContentResolver().registerContentObserver(
          mLookupUri, true, mObserver);
    }
    if (mPostViewNotification) {
      // inform the source of the data that this contact is being looked at
      postViewNotificationToSyncAdapter();
    }
  }
  super.deliverResult(mContact);
}

相关文章