'How can I get the info of an image with exifinterface in the fragment

Uri uri = ImageView.setImageURI(Uri.parse(new File(path).toString()));
gfgIn = getContentResolver().openInputStream(uri);
ExifInterface exifInterface = new ExifInterface(gfgIn);

The code above isn't work in my fragment. How can I rewrite it ?



Solution 1:[1]

Like most Android SDK classes, ExifInterface has documentation. In particular, that documentation contains a list of public constructors.

The first such constructor takes a File as its sole constructor parameter.

You appear to be looking to get this information from a File, identified by a variable named path.

So, use new ExifInterface(path).

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 CommonsWare