private void loadSelectedStage() {
   final StageInformation st = selectedStage;
   if (st != null && st.gpxFile != null) {
     if (st.gpx == null) {
       st.gpx = GPXUtilities.loadGPXFile(app, st.gpxFile);
     }
   }
 }
  private String saveImport(final GPXUtilities.GPXFile gpxFile, final String fileName) {
    final String warning;

    if (gpxFile.isEmpty()) {
      warning = application.getString(R.string.error_reading_gpx);
    } else {
      final File importDir = application.getAppPath(IndexConstants.GPX_IMPORT_DIR);
      importDir.mkdirs();
      if (importDir.exists() && importDir.isDirectory() && importDir.canWrite()) {
        final GPXUtilities.WptPt pt = gpxFile.findPointToShow();
        final File toWrite = getFileToSave(fileName, importDir, pt);

        warning = GPXUtilities.writeGpxFile(toWrite, gpxFile, application);
        if (warning == null) {
          gpxFile.path = toWrite.getAbsolutePath();
        }
      } else {
        warning = application.getString(R.string.sd_dir_not_accessible);
      }
    }

    return warning;
  }
示例#3
0
 public String saveFile() {
   return GPXUtilities.writeGpxFile(new File(gpx.path), gpx, app);
 }