1

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.

4

3 回答 3

6

通过Exif接口,如果相机写的话。看看这里

ExifInterface exif = new ExifInterface(pathToTheImage);
String datetime =  exif.getAttribute(ExifInterface.TAG_DATETIME);
于 2013-07-17T12:38:56.303 回答
1

使用以下方法获取图像的拍摄日期

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;
}
于 2013-07-17T12:45:43.483 回答
0

创建一个字符串变量

在该字符串变量中调用简单的日期格式对象

new SimpleDateFormat("yyyyMMdd_HHmmss") .format(new Date());

现在将此字符串传递到图像路径...

于 2013-07-17T12:45:58.303 回答