I would say it is because of the _
(underscore) in the enum name, it is unable to find a match. I am assuming this is because enum names cannot start with a number. Perhaps if you modify your code as follows it will work:
if(Character.isDigit(ext.charAt(0)))
{
ext = "_" + ext;
}
if (SupportedFileFormat.valueOf(ext.toUpperCase(Locale.US)) != null) {
Log.i("extension", ext);
return true;
}
Basically, the code is looking to see if the extension starts with a number, if it does we add an underscore to the start to ensure it matches with our enum naming convention
Of course it would be a lot simpler if you just had an array of strings to hold your supported file formats, rather than an enum