Iam developing one android Application, in which iam using the Camera Functionality. Is there any way to get the Captured Images's Creation Dates in Android?
Thanks for any help.
Iam developing one android Application, in which iam using the Camera Functionality. Is there any way to get the Captured Images's Creation Dates in Android?
Thanks for any help.
通过Exif接口,如果相机写的话。看看这里
ExifInterface exif = new ExifInterface(pathToTheImage);
String datetime = exif.getAttribute(ExifInterface.TAG_DATETIME);
使用以下方法获取图像的拍摄日期
private String getPhotoCapturedDate(String filePath){
//String capturedDate = null;
try {
ExifInterface exif = new ExifInterface(filePath);
if(exif != null){
return exif.getAttribute(ExifInterface.TAG_DATETIME);
}
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
创建一个字符串变量
在该字符串变量中调用简单的日期格式对象
new SimpleDateFormat("yyyyMMdd_HHmmss") .format(new Date());
现在将此字符串传递到图像路径...