public ExportOptionsDialog(final List<cgCache> caches, final Activity activity) {
      super(activity);

      View layout = activity.getLayoutInflater().inflate(R.layout.gpx_export_dialog, null);
      setView(layout);

      final TextView text = (TextView) layout.findViewById(R.id.info);
      text.setText(getString(R.string.export_gpx_info, Settings.getGpxExportDir()));

      final CheckBox shareOption = (CheckBox) layout.findViewById(R.id.share);

      shareOption.setChecked(Settings.getShareAfterExport());

      shareOption.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              Settings.setShareAfterExport(shareOption.isChecked());
            }
          });

      layout
          .findViewById(R.id.export)
          .setOnClickListener(
              new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                  dismiss();
                  new ExportTask(caches, activity).execute((Void) null);
                }
              });
    }
 @Override
 protected void onPostExecute(Boolean result) {
   if (null != activity) {
     progress.dismiss();
     if (result) {
       ActivityMixin.showToast(
           activity,
           getName()
               + ' '
               + getString(R.string.export_exportedto)
               + ": "
               + exportFile.toString());
       if (Settings.getShareAfterExport()) {
         Intent shareIntent = new Intent();
         shareIntent.setAction(Intent.ACTION_SEND);
         shareIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(exportFile));
         shareIntent.setType("application/xml");
         activity.startActivity(
             Intent.createChooser(shareIntent, getString(R.string.export_gpx_to)));
       }
     } else {
       ActivityMixin.showToast(activity, getString(R.string.export_failed));
     }
   }
 }