public boolean isAllowedFileExtension(String extension) { boolean isSupported = false; try { ///Instead of this code block, use following block
if (extension.contains("pdf") || extension.contains("doc") || extension.contains("docx") || extension.contains("ppt") || extension.contains("pptx") || extension.contains("apk") || extension.contains("zip") || extension.contains("rar"))
{ isSupported = true; } ///Use this code block, instead of above code block
String[] fieldsToInclude = {"pdf", "doc", "docx","ppt"};
for (int i = 0; i < fieldsToInclude.length; i++) { if (extension.contains(fieldsToInclude[i])) isSupported = true; break; } } catch (Exception e) { Log.e("isAllowedFile", e.toString()); } return isSupported; }