Пример #1
0
  /**
   * 保存经纬度
   *
   * @return
   */
  private void keepLocation(String latitude, String longitude) {
    BufferedWriter locationWriteer = null;
    File locationFile = null;
    try {
      File dir = new File(FileUtils.getMemoryDirPath() + File.separator + FileUtils.ATTACHMANEPATH);
      if (!dir.exists()) {
        dir.mkdirs();
      }
      locationFile = new File(dir, "location.txt");
      locationWriteer = new BufferedWriter(new BufferedWriter(new FileWriter(locationFile, true)));

      StringBuilder locationInfo = new StringBuilder();

      locationInfo.append(latitude);
      locationInfo.append(",");
      locationInfo.append(longitude);
      locationInfo.append(",");
      locationInfo.append(DateUtils.getCurrentDateTimeStr());
      locationWriteer.write(locationInfo.toString());
      locationWriteer.newLine();
    } catch (Exception e) {
      Logger.error(Logger.LOG_SYSTEM_ERROR, e, "收集经纬度信息出错");
      if (null != locationFile) locationFile.delete();
    } finally {
      try {
        locationWriteer.close();
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
  }
Пример #2
0
 /**
  * 根据当前系统中SDcard的状态是否可用,将自动创建一个目录<br>
  * 如SDcard可用,将在SDcard的跟目录下,创建一个目录<br>
  * 如不可用,将在程序的安装目录下,创建目录
  */
 private void CreatDir() {
   try {
     fileUtils.createDirByState(path);
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
Пример #3
0
 /**
  * 相片的完整目录路径
  *
  * @return
  */
 private String getDirPath() {
   String PhotoDIR = FileUtils.getFilePath(path);
   return PhotoDIR;
 }