开发者

Reading EXIF Info

开发者 https://www.devze.com 2023-03-15 15:02 出处:网络
I am trying to read the all the media files from the SD card and get the EXIF data for the first file but it\'s not working. The code is:

I am trying to read the all the media files from the SD card and get the EXIF data for the first file but it's not working. The code is:

String[] proj = { MediaStore.Images.Media.DATA };
Cursor c = managedQuery(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, proj,
                null, null, null);
String imagePath = "";
if(c!= null &&  c.moveToFirst()){
  imagePath = c.getString(c.getColumnIndexOrThrow(MediaStore.Images.Media.DATA));
  if (!c.isClosed()) {
    c.close();
  }
}
if(!imagePath.equals("")){
    ExifInterface exif = new ExifInterface(imagePath);
   开发者_运维百科 String updated = exif.getAttribute(ExifInterface.TAG_DATETIME);
    system.print.out("Photo updated at:"+updated);
}

The sysout is printing "null".


you can only get exif information for image file with .jpeg extension even not for .jpg extension.

0

精彩评论

暂无评论...
验证码 换一张
取 消