@TargetApi(Build.VERSION_CODES.HONEYCOMB)
  private void onShareEpisode(ShareMethod shareMethod) {
    // Episode of this fragment is always the first item in the cursor
    final Cursor episode = (Cursor) mAdapter.getItem(0);
    final SherlockFragmentActivity activity = getSherlockActivity();
    if (episode != null && activity != null) {
      Bundle shareData = new Bundle();
      String episodestring = ShareUtils.onCreateShareString(activity, episode);
      String sharestring = getString(R.string.share_checkout);
      sharestring += " \"" + episode.getString(DetailsQuery.SHOW_TITLE);
      sharestring += " - " + episodestring + "\"";
      shareData.putString(ShareItems.EPISODESTRING, episodestring);
      shareData.putString(ShareItems.SHARESTRING, sharestring);
      shareData.putInt(ShareItems.EPISODE, episode.getInt(DetailsQuery.NUMBER));
      shareData.putInt(ShareItems.SEASON, episode.getInt(DetailsQuery.SEASON));
      shareData.putInt(ShareItems.TVDBID, episode.getInt(DetailsQuery.REF_SHOW_ID));

      // IMDb id
      String imdbId = episode.getString(DetailsQuery.IMDBID);
      if (TextUtils.isEmpty(imdbId)) {
        // fall back to show IMDb id
        imdbId = episode.getString(DetailsQuery.SHOW_IMDBID);
      }
      shareData.putString(ShareItems.IMDBID, imdbId);

      // don't close cursor!
      // episode.close();

      ShareUtils.onShareEpisode(activity, shareData, shareMethod);

      // invalidate the options menu so a potentially new
      // quick share action is displayed
      activity.invalidateOptionsMenu();
    }
  }
  /**
   * Builds a new {@link CheckInDialogFragment} setting all values based on the given episode TVDb
   * id. Might return null.
   */
  public static CheckInDialogFragment newInstance(Context context, int episodeTvdbId) {
    CheckInDialogFragment f = null;

    final Cursor episode =
        context
            .getContentResolver()
            .query(
                Episodes.buildEpisodeWithShowUri(episodeTvdbId),
                CheckInQuery.PROJECTION,
                null,
                null,
                null);
    if (episode != null) {
      if (episode.moveToFirst()) {
        f = new CheckInDialogFragment();
        Bundle args = new Bundle();
        args.putString(InitBundle.TITLE, episode.getString(CheckInQuery.SHOW_TITLE));
        args.putInt(InitBundle.SHOW_TVDB_ID, episode.getInt(CheckInQuery.SHOW_TVDB_ID));
        args.putInt(InitBundle.SEASON, episode.getInt(CheckInQuery.SEASON));
        args.putInt(InitBundle.EPISODE, episode.getInt(CheckInQuery.NUMBER));
        args.putString(InitBundle.SHOW_GETGLUE_ID, episode.getString(CheckInQuery.SHOW_GETGLUE_ID));

        String episodeTitleWithNumbers = ShareUtils.onCreateShareString(context, episode);
        args.putString(InitBundle.ITEM_TITLE, episodeTitleWithNumbers);
        args.putString(InitBundle.DEFAULT_MESSAGE, episodeTitleWithNumbers);
        f.setArguments(args);
      }
      episode.close();
    }

    return f;
  }
  private void onAddCalendarEvent() {
    fireTrackerEvent("Add to calendar");

    // Episode of this fragment is always the first item in the cursor
    final Cursor episode = (Cursor) mAdapter.getItem(0);
    if (episode != null && episode.moveToFirst()) {
      String showTitle = episode.getString(DetailsQuery.SHOW_TITLE);
      String episodeTitleAndNumber = ShareUtils.onCreateShareString(getSherlockActivity(), episode);
      long showAirTime = episode.getLong(DetailsQuery.FIRSTAIREDMS);
      int showRunTime = episode.getInt(DetailsQuery.SHOW_RUNTIME);

      ShareUtils.onAddCalendarEvent(
          getActivity(), showTitle, episodeTitleAndNumber, showAirTime, showRunTime);
    }
  }