Java tutorial
//package com.java2s; import android.text.TextUtils; public class Main { public static boolean isVideoFile(String suffix) { if (TextUtils.isEmpty(suffix)) { return false; } if (suffix.startsWith(".")) { suffix = suffix.substring(1); } String videoFormat[] = new String[] { "MP4", "3GP" }; for (int i = 0; i < videoFormat.length; i++) { if (suffix.equalsIgnoreCase(videoFormat[i])) { return true; } } return false; } /** * Returns true if the string is null or 0-length. * * @param str * the string to be examined * @return true if str is null or zero length */ public static boolean isEmpty(CharSequence str) { if (str == null || str.length() == 0 || "null".equals(str.toString().trim())) return true; else return false; } }