I was looking at many problems but still im confused.
I want to add the exif block in my file where and how can i do this .
I am new to Android Programming language. I have a camera code i generate a photo file with a unique name and it smoothly saves photo in my own created directory on sdcard. However, i am unable to judge how to insert the EXIFINTERFACE to my photo file. I want to assign gps coordinates, I have a location listener class working and i will get Lattitude Longitude Strings from there for setting attributes of Exif block
ExifInterface exif = new ExifInterface(string filepath);
this command requires string of filepath and i am generating file in two methods.
public static File getPhotoDirectory() {
File outputDir = null;
String externalStorageState = Environment.getExternalStorageState();
if (externalStorageState.equals(Environment.MEDIA_MOUNTED)) {
File pictureDir =
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
outputDir = new File(pictureDir, "HasanDirectory");
if(!outputDir.exists()) {
if(!outputDir.mkdirs()) {
String message = "Failed to create directory:" + outputDir.getAbsolutePath();
Log.e(LOG_TAG, message);
outputDir = null;
}
}
}
return outputDir;
}
public static File generateTimeStampPhotoFile() {
File photoFile = null;
File outputDir = getPhotoDirectory();
if (outputDir != null) {
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
//if (type == MEDIA_TYPE_IMAGE){
picCount++; // "HA" provides a unique number to each pic
String photoFileName = "IMG_" + timeStamp + "_" + picCount + ".jpg";
photoFile = new File(outputDir, photoFileName);
}
return photoFile;
}
Guide me how can i add the exif block?
OR please, if you are reading this far? what are other methods to assign GPS coordinates to a picture? does setParameters function of Camera class in android works?