private void processDirectory(File current) {
        if (current.isDirectory()) {
            // process it recursively
            File[] subs = current.listFiles(new FileFilter() {
                Pattern pattern = Pattern.compile(".java|.xml|.png|.txt|.aidl|.mk");
                public boolean accept(File file) {
                    if (file.isDirectory()) {
                        // exclude /assets and /gen
                        return !(file.getName().equals("assets") ||
                                file.getName().equals("gen") ||
                                file.getName().equals("bin"));
                    }
                    String fn = file.getName();
//                    System.out.println(fn);
                    final int index = fn.lastIndexOf(".");
                    if (index == -1) {
                        // skip those file without an extension
                        return false;
                    }
                    String ext = fn.substring(index, fn.length());
                    return pattern.matcher(ext).matches();
                }
            });
            for (File sub : subs) {
                processDirectory(sub);
            }
        } else {
            processFile(current);
        }
    }