Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import android.media.ExifInterface;

import android.os.Bundle;

import java.io.IOException;

public class Main {
    public static final String[] EXIF_TAGS = { "FNumber", ExifInterface.TAG_DATETIME, "ExposureTime",
            ExifInterface.TAG_FLASH, ExifInterface.TAG_FOCAL_LENGTH, "GPSAltitude", "GPSAltitudeRef",
            ExifInterface.TAG_GPS_DATESTAMP, ExifInterface.TAG_GPS_LATITUDE, ExifInterface.TAG_GPS_LATITUDE_REF,
            ExifInterface.TAG_GPS_LONGITUDE, ExifInterface.TAG_GPS_LONGITUDE_REF,
            ExifInterface.TAG_GPS_PROCESSING_METHOD, ExifInterface.TAG_GPS_TIMESTAMP,
            ExifInterface.TAG_IMAGE_LENGTH, ExifInterface.TAG_IMAGE_WIDTH, "ISOSpeedRatings",
            ExifInterface.TAG_MAKE, ExifInterface.TAG_MODEL, ExifInterface.TAG_WHITE_BALANCE, };

    /**
     * Load the exif tags into the passed Bundle
     *
     * @param filepath
     * @param out
     * @return true if exif tags are loaded correctly
     */
    public static boolean loadAttributes(final String filepath, Bundle out) {
        ExifInterface e;
        try {
            e = new ExifInterface(filepath);
        } catch (IOException e1) {
            e1.printStackTrace();
            return false;
        }

        for (String tag : EXIF_TAGS) {
            out.putString(tag, e.getAttribute(tag));
        }
        return true;
    }
}