所有ExifInterface值都返回0或null [英] all ExifInterface value returns 0 or null

查看:97
本文介绍了所有ExifInterface值都返回0或null的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试获取图像的gps位置,但是我得到的只是null/0,我试图从其他图像中获取其他exif信息,但结果仍然是null/0

Im trying to get the gps location of the images, but all i got is null/0, i tried to fetch other exif info from different images but the results are still either null/0

public void MarkGeoTagImage(String imagePath)
{
    try {
        ExifInterface exif = new ExifInterface(imagePath);
Toast.makeText(MainActivity.this, imagePath, Toast.LENGTH_LONG).show();
        Toast.makeText(MainActivity.this, exif.getAttribute(ExifInterface.TAG_GPS_LONGITUDE),Toast.LENGTH_LONG).show();
    } catch (IOException e) {
        e.printStackTrace();
    }
}

第一个Toast显示图像的绝对路径,例如/storage/sdcard0/etp_images/test.jpg,但是第二个Toast仅显示0或为空.

The first toast shows the absolute path of the image like /storage/sdcard0/etp_images/test.jpg, but the second toast only shows 0 or null as results.

推荐答案

可能不是解决方案,但是我以前在ExifInterface上遇到了一些问题.原始类ExifInterface具有不同的错误.尝试使用此类的支持版本.就我而言,它解决了我的问题. 使用Gradle进行编译:com.android.support:exifinterface:25.1.0

Probably it is not a solution, but I had some problem with ExifInterface before. Original class ExifInterface has different bugs. Try to use support version of this class. In my case it resolved my problem. Compile this using Gradle: com.android.support:exifinterface:25.1.0

这篇关于所有ExifInterface值都返回0或null的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆