Skip to content Skip to sidebar Skip to footer

Filenotfoundexception When Using Exifinterface

I have been uploading images to FirebaseStorage, but often they are the wrong way around when displaying them. I have discovered the ExifInterface that can determined the orientati

Solution 1:

A Uri is not a File.

Step #1: Delete File file = new File(uri.toString());

Step #2: Make sure that you are using the Support Library edition of ExifInterface

Step #3: Call getContentResolver() on your Activity to get a ContentResolver

Step #4: Call openInputStream() on the ContentResolver, passing in the Uri, to get an InputStream on the content pointed to by that Uri

Step #5: Pass that InputStream to the ExifInterface constructor

Step #6: Use that ExifInterface as you are presently, to determine the image orientation

Step #7: Once you get things working, move all of this I/O to a background thread

Post a Comment for "Filenotfoundexception When Using Exifinterface"