Advertisement
Guest User

ExifInterface

a guest
Aug 24th, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.75 KB | None | 0 0
  1. private void setExifData(String children) {
  2.  
  3.         // Creating a temporary directory to store the images from SDcard.
  4.         dataFile = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS) + "/temporary"); // Pass getFilesDir() and "MyFile" to read file
  5.  
  6.         try {
  7.             String dataPath = dataFile.getAbsolutePath() + "/" + children;
  8.             Log.i("inform","datapath is: " + dataPath);
  9.             exifData = new ExifInterface(dataPath);
  10.         } catch (IOException ioE) {
  11.             Log.e("Error", "get path error: " + ioE.getMessage());
  12.         }
  13.         Log.i("inform", "setting attributs" + Double.toString(getLongitude()) );
  14.         exifData.setAttribute(ExifInterface.TAG_GPS_LONGITUDE, Double.toString(getLongitude()));
  15.         exifData.setAttribute(ExifInterface.TAG_GPS_LATITUDE, Double.toString(getLatitude()));
  16.         exifData.setAttribute(ExifInterface.TAG_GPS_ALTITUDE, Double.toString(getAltitude()));
  17.         exifData.setAttribute(ExifInterface.TAG_ARTIST, Double.toString(getUserID()));
  18.         exifData.setAttribute(ExifInterface.TAG_USER_COMMENT,
  19.                 "{" +
  20.                 "\"UltrasoundHeight\":" + Double.toString(getuHeight()) +
  21.                 "\"Direction\":" + Double.toString(getDirection())+
  22.                 ",\"Batteri\":" + Double.toString(getBattery()) +
  23.                 ",\"maxSpeed\":" + Double.toString(getMaxSpeed()) +
  24.                 ",\"Distance\":" + Double.toString(getDistance()) +
  25.                 ",\"CameraAngle\":" + Double.toString(getCameraAngle()) +
  26.                 "}");
  27.  
  28.         try {
  29.             exifData.saveAttributes();
  30.         } catch (IOException ioE) {
  31.             Log.e("Error", "could not save Attributes" + ioE.getMessage());
  32.         }
  33.  
  34.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement