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();
}
}
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.
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