I check my files in a folder on the sd card on certain extensions. Everything goes well, except for the .3gp files seem not to be recognized by this code although it is listed in the possible formats. Any idea what might be causing this?
public enum SupportedFileFormat {
_3GP("3gp"), MP4("mp4"), M4A("m4a"), AAC("aac"), TS("ts"), FLAC("flac"), MP3(
"mp3"), MID("mid"), XMF("xmf"), MXMF("mxmf"), RTTTL("rtttl"), RTX(
"rtx"), OTA("ota"), IMY("imy"), OGG("ogg"), MKV("mkv"), WAV(
"wav");
private String filesuffix;
SupportedFileFormat(String filesuffix) {
this.filesuffix = filesuffix;
}
public String getFilesuffix() {
return filesuffix;
}
}
@SuppressLint("DefaultLocale")
private boolean checkExtension(String fileName) {
String ext = getFileExtension(fileName);
if (ext == null)
return false;
try {
if (SupportedFileFormat.valueOf(ext.toUpperCase(Locale.US)) != null) {
Log.i("extension", ext);
return true;
}
} catch (IllegalArgumentException e) {
return false;
}
return false;
}
public String getFileExtension(String fileName) {
int i = fileName.lastIndexOf('.');
if (i > 0) {
return fileName.substring(i + 1);
} else
return null;
}