Best code examples for Android ExifInterface class (android.media.ExifInterface)

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android ExifInterface class.
You can now enable Codota on your own code to easily search and navigate your Java codebase.

Android ExifInterface examples from Open Source projects
This code example shows how to use the following methods: getAttribute
    } 
 
    public static int getExifRotation(String imgPath) {
    	int rotate = 0;
        try { 
            ExifInterface exif = new ExifInterface(imgPath);
            String rotationAmount = exif.getAttribute(ExifInterface.TAG_ORIENTATION);
            if (!TextUtils.isEmpty(rotationAmount)) {
                int rotationParam = Integer.parseInt(rotationAmount);
                switch (rotationParam) {
                case ExifInterface.ORIENTATION_NORMAL:
                	rotate = 0;
                	break; 
                case ExifInterface.ORIENTATION_ROTATE_90:
                	rotate = 90;
                	break; 
                case ExifInterface.ORIENTATION_ROTATE_180:
                	rotate = 180;
                	break; 
                case ExifInterface.ORIENTATION_ROTATE_270:
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getAttributeInt
			cursor.close();
			int rotation = 0;
			 
			try 
			{ 
				ExifInterface exifInterface = new ExifInterface(filepath);
				int exifRotation = exifInterface.getAttributeInt(ExifInterface.TAG_ORIENTATION,ExifInterface.ORIENTATION_UNDEFINED);
 
				if(exifRotation!=ExifInterface.ORIENTATION_UNDEFINED)
				{ 
					switch(exifRotation)
					{ 
						case ExifInterface.ORIENTATION_ROTATE_180 :
							rotation = 180;
							break; 
						case ExifInterface.ORIENTATION_ROTATE_270 :
							rotation = 270;
							break; 
						case ExifInterface.ORIENTATION_ROTATE_90 :
							rotation = 90;
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getAttributeInt
	 
	public static int getExifOrientation(String filepath) {
		int degree = 0;
		ExifInterface exif = null;
		try { 
			exif = new ExifInterface(filepath);
		} catch (IOException ex) {
			ex.printStackTrace();
		} 
		if (exif != null) {
			int orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, -1);
			if (orientation != -1) {
				// We only recognise a subset of orientation tag values. 
				switch (orientation) {
				case ExifInterface.ORIENTATION_ROTATE_90:
					degree = 90;
					break; 
				case ExifInterface.ORIENTATION_ROTATE_180:
					degree = 180;
					break; 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getAttributeInt
     * @return 
     * @throws IOException 
     */ 
    public static int getOrientationInDegreesForFileName(String fileName) throws IOException
    { 
        ExifInterface exif = new ExifInterface(fileName);
        int rotation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION,
                ExifInterface.ORIENTATION_NORMAL);
        int rotationInDegrees = exifToDegrees(rotation);
        return rotationInDegrees;
    } 
 
    /** 
     * Convert exif orientation information to degrees. 
     * Idea and code taken from http://stackoverflow.com/a/11081918/527759 
     *  
     * @param exifOrientation 
     * @return 
     */ 
    private static int exifToDegrees(int exifOrientation) {
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: saveAttributes, setAttribute
     */ 
    public void replaceExifTag(String tag, String value) {
        if (mExif == null) {
            loadExifData(); 
        } 
        mExif.setAttribute(tag, value);
    } 
 
    private void loadExifData() { 
        try { 
            mExif = new ExifInterface(mDataPath);
        } catch (IOException ex) {
            Log.e(TAG, "cannot read exif", ex);
        } 
    } 
 
    private void saveExifData() throws IOException { 
        if (mExif != null) {
            mExif.saveAttributes();
        } 

6
CodeRank
Related Android ExifInterface Questions & Answers:
See Code Examples for Android ExifInterface Methods: