示例#1
0
  /** {@inheritDoc} */
  @Override
  public void onLoadFinished(final Loader<List<Song>> loader, final List<Song> data) {
    // Check for any errors
    if (data.isEmpty()) {
      return;
    }

    // Start fresh
    mAdapter.unload();
    // Return the correct count
    mAdapter.setCount(data);
    // Add the data to the adpater
    for (final Song song : data) {
      mAdapter.add(song);
    }
  }
  /** {@inheritDoc} */
  @Override
  public void onLoadFinished(final Loader<List<Song>> loader, final List<Song> data) {
    // Check for any errors
    if (data.isEmpty()) {
      // Set the empty text
      final TextView empty = (TextView) mRootView.findViewById(R.id.empty);
      empty.setText(getString(R.string.empty_last_added));
      mListView.setEmptyView(empty);
      return;
    }

    // Start fresh
    mAdapter.unload();
    // Return the correct count
    mAdapter.setCount(data);
    // Add the data to the adpater
    for (final Song song : data) {
      mAdapter.add(song);
    }
  }
 /** {@inheritDoc} */
 @Override
 public void onLoaderReset(final Loader<List<Song>> loader) {
   // Clear the data in the adapter
   mAdapter.unload();
 }