Android File Type Check isImage(String fileName)

Here you can find the source of isImage(String fileName)

Description

is Image

Declaration

public static boolean isImage(String fileName) 

Method Source Code

//package com.java2s;

public class Main {
    public static boolean isImage(String fileName) {
        String extension = getFileExtension(fileName.toLowerCase());
        return "jpg".equals(extension) || "jpeg".equals(extension)
                || "gif".equals(extension) || "png".equals(extension)
                || "bmp".equals(extension) || "icon".equals(extension);
    }/* www.  ja va2 s.c om*/

    public static String getFileExtension(String fileName) {
        int index = fileName.lastIndexOf(".");
        if (index == -1)
            return null;
        return fileName.substring(index + 1);
    }
}

Related

  1. isAttacheFile(String fileName)
  2. isExeFile(String fileName)
  3. isForbidFile(String fileName)
  4. isImgageFile(String fileName)