@Override
  protected void updateTracksData(BreadcrumbsTracks tracks) {
    tracks.setAllBundleIds(mBundleIds);

    for (Object[] bundle : mBundles) {
      Integer bundleId = (Integer) bundle[0];
      String bundleName = (String) bundle[1];
      String bundleDescription = (String) bundle[2];

      tracks.addBundle(bundleId, bundleName, bundleDescription);
    }
  }
  @Override
  protected void onPostExecute(Uri result) {
    super.onPostExecute(result);

    long ogtTrackId = Long.parseLong(result.getLastPathSegment());
    Uri metadataUri =
        Uri.withAppendedPath(
            ContentUris.withAppendedId(Tracks.CONTENT_URI, ogtTrackId), "metadata");

    BreadcrumbsTracks tracks = mAdapter.getBreadcrumbsTracks();
    Integer bcTrackId = mTrack.second;
    Integer bcBundleId = tracks.getBundleIdForTrackId(bcTrackId);
    // TODO Integer bcActivityId = tracks.getActivityIdForBundleId(bcBundleId);
    String bcDifficulty = tracks.getValueForItem(mTrack, BreadcrumbsTracks.DIFFICULTY);
    String bcRating = tracks.getValueForItem(mTrack, BreadcrumbsTracks.RATING);
    String bcPublic = tracks.getValueForItem(mTrack, BreadcrumbsTracks.ISPUBLIC);
    String bcDescription = tracks.getValueForItem(mTrack, BreadcrumbsTracks.DESCRIPTION);

    ArrayList<ContentValues> metaValues = new ArrayList<ContentValues>();
    if (bcTrackId != null) {
      metaValues.add(buildContentValues(BreadcrumbsTracks.TRACK_ID, Long.toString(bcTrackId)));
    }
    if (bcDescription != null) {
      metaValues.add(buildContentValues(BreadcrumbsTracks.DESCRIPTION, bcDescription));
    }
    if (bcDifficulty != null) {
      metaValues.add(buildContentValues(BreadcrumbsTracks.DIFFICULTY, bcDifficulty));
    }
    if (bcRating != null) {
      metaValues.add(buildContentValues(BreadcrumbsTracks.RATING, bcRating));
    }
    if (bcPublic != null) {
      metaValues.add(buildContentValues(BreadcrumbsTracks.ISPUBLIC, bcPublic));
    }
    if (bcBundleId != null) {
      metaValues.add(buildContentValues(BreadcrumbsTracks.BUNDLE_ID, Integer.toString(bcBundleId)));
    }
    //      if (bcActivityId != null)
    //      {
    //         metaValues.add(buildContentValues(BreadcrumbsTracks.ACTIVITY_ID,
    // Integer.toString(bcActivityId)));
    //      }
    ContentResolver resolver = mContext.getContentResolver();
    resolver.bulkInsert(metadataUri, metaValues.toArray(new ContentValues[1]));

    tracks.addSyncedTrack(ogtTrackId, mTrack.second);
  }
 public void clearAllCache(Context ctx) {
   BreadcrumbsTracks.initCacheVariables();
   setChanged();
   clearPersistentCache(ctx);
   notifyObservers();
 }
 static {
   BreadcrumbsTracks.initCacheVariables();
 }