开发者

Reading EXIF Info

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜