public class checkImg {
// filePath存放图片的路径或者地址 public static boolean isImage(String filePath){ File file = new File(filePath); if (!file.exists()) { return false; } BitmapFactory.Options options = null; if (options == null) options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; BitmapFactory.decodeFile(filePath, options); //filePath代表图片路径 if (options.mCancel || options.outWidth == -1 || options.outHeight == -1) { //表示图片已损毁 return false; }else{ return true; } } }