Example #1
0
  /** {@inheritDoc} */
  @Override
  public void onLoadFinished(final Loader<List<Artist>> loader, final List<Artist> 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_music));
      if (isSimpleLayout()) {
        mListView.setEmptyView(empty);
      } else {
        mGridView.setEmptyView(empty);
      }
      return;
    }

    // Start fresh
    mAdapter.unload();
    // Add the data to the adpater
    for (final Artist artist : data) {
      mAdapter.add(artist);
    }
    // Build the cache
    mAdapter.buildCache();
  }
Example #2
0
 /** {@inheritDoc} */
 @Override
 public void onLoaderReset(final Loader<List<Artist>> loader) {
   // Clear the data in the adapter
   mAdapter.unload();
 }