我使用此代码获取有关sdcard中图像的信息,
File file = (File) iterator.next();
ExifInterface exif = new ExifInterface(file.getAbsolutePath());
String Date_Time = getExifTag(exif, ExifInterface.TAG_DATETIME);
String Flash = getExifTag(exif, ExifInterface.TAG_FLASH);
String Focal_Length = getExifTag(exif, ExifInterface.TAG_FOCAL_LENGTH) ;
String GPS_Datestamp = getExifTag(exif, ExifInterface.TAG_FLASH);
String GPS_Latitude = getExifTag(exif, ExifInterface.TAG_GPS_LATITUDE);
String GPS_Latitude_Ref = getExifTag(exif, ExifInterface.TAG_GPS_LATITUDE_REF);
String GPS_Longitude = getExifTag(exif, ExifInterface.TAG_GPS_LONGITUDE);
String GPS_Longitude_Ref = getExifTag(exif, ExifInterface.TAG_GPS_LONGITUDE_REF);
String GPS_Processing_Method = getExifTag(exif, ExifInterface.TAG_GPS_PROCESSING_METHOD);
String GPS_Timestamp = getExifTag(exif, ExifInterface.TAG_GPS_TIMESTAMP) ;
String Image_Length = getExifTag(exif, ExifInterface.TAG_IMAGE_LENGTH);
String Image_Width = getExifTag(exif, ExifInterface.TAG_IMAGE_WIDTH) ;
String Camera_Make = getExifTag(exif, ExifInterface.TAG_MAKE);
String Camera_Model = getExifTag(exif, ExifInterface.TAG_MODEL);
String Camera_Orientation = getExifTag(exif, ExifInterface.TAG_ORIENTATION);
String Camera_White_Balance = getExifTag(exif, ExifInterface.TAG_WHITE_BALANCE);
但是GPS_Longitude,GPS_Latitude返回null?
我在位置服务ON时捕获了新照片,但仍然返回null。
答案 0 :(得分:1)
我解决了我的问题,如果我们想要显示拍摄的照片的位置, 在拍摄任何图像之前,我们必须在相机设置中启用“GPS TAG”,
转到相机>>设置>> GPS标签>>从关闭切换到开启。
然后上面的代码完全有效。