Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.text.TextUtils;

public class Main {

    public static boolean isAudioFile(String suffix) {
        if (TextUtils.isEmpty(suffix)) {
            return false;
        }
        if (suffix.startsWith(".")) {
            suffix = suffix.substring(1);
        }
        String audioFormat[] = new String[] { "AMR" };
        for (int i = 0; i < audioFormat.length; i++) {
            if (suffix.equalsIgnoreCase(audioFormat[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;
    }
}