0

When camera application captures a photo, it saves Date Taken data in the captured image. As shown in below screen.

enter image description here

I have created custom camera in Android. I want to write the same field Date Taken data on a JPEG file, I used ExifInterface.TAG_DATETIME field to achieve this. But the API is not able to write this field. See the below image. Please tell me what can be the issue?

enter image description here

I used below code to achieve this:

ExifInterface mObjExifInterface = new ExifInterface(amsFCapturePhoto);
mObjExifInterface.setAttribute(ExifInterface.TAG_DATETIME, getDateTimeByFormat(
                        DATE_FORMAT_YEAR_MONTH_DATE_SHORT_TIME));
mObjExifInterface.saveAttributes();

Thanks in advance.

AndroidDev
  • 2,627
  • 6
  • 29
  • 41
  • the code seems clear, debug the value returned by `getDateTimeByFormat( DATE_FORMAT_YEAR_MONTH_DATE_SHORT_TIME)` – anil May 26 '15 at 08:26
  • @anil: Its giving **2015-06-01 11:19:05**. Are you pointing, this issue could be of date format!! – AndroidDev May 26 '15 at 08:45
  • possibly [duplicate](http://stackoverflow.com/questions/9004462/cant-set-date-taken-datetime-tag-using-the-exifinterface-in-android) – bilal May 26 '15 at 08:57
  • @bilal: I have already gone through that possible duplicate. But as it did not solve my issue thats why I posted this question. – AndroidDev May 26 '15 at 09:36
  • Did you check for an error returned by the setAttribute call? – BitBank May 26 '15 at 15:40

0 Answers0