Question

I used this code to get information about images in 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);

BUT GPS_Longitude,GPS_Latitude returned null?

I captured new photo when location services ON, But still returned null.

Was it helpful?

Solution

I solved my problem, If we want to display location of photo that be captured, We must enable "GPS TAG" in Camera setting before you capture any image,

Go to camera >> Setting >> GPS Tag >> Switch from off to on.

Then The code above worked completely.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top