Java Code Examples for com.eveningoutpost.dexdrip.utils.FileUtils

The following examples show how to use com.eveningoutpost.dexdrip.utils.FileUtils. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
private boolean findAllDatabases() {
    databases = new ArrayList<>();

    File file = new File(FileUtils.getExternalDir(getApplicationContext()));
    if (!FileUtils.makeSureDirectoryExists(file.getAbsolutePath())) {
        return false;
    }

    // add from "root"
    addAllDatabases(file, databases);

    // add from level below (Andriod usually unzips to a subdirectory)
    File[] subdirectories = file.listFiles(new FileFilter() {
        @Override
        public boolean accept(File path) {
            return path.isDirectory();
        }
    });
    for (File subdirectory : subdirectories) {
        addAllDatabases(subdirectory, databases);
    }
    return true;
}
 
Example 2
Source Project: xDrip   Source File: ImportDatabaseActivity.java    License: GNU General Public License v3.0 5 votes vote down vote up
private boolean findAllDatabases() {
    databases = new ArrayList<>();

    File file = new File(FileUtils.getExternalDir());
    if (!FileUtils.makeSureDirectoryExists(file.getAbsolutePath())) {
        return false;
    }

    // add from "root"
    addAllDatabases(file, databases);

    // add from level below (Andriod usually unzips to a subdirectory)
    File[] subdirectories = file.listFiles(new FileFilter() {
        @Override
        public boolean accept(File path) {
            return path.isDirectory();
        }
    });
    try {
        for (File subdirectory : subdirectories) {
            addAllDatabases(subdirectory, databases);
        }
    } catch (NullPointerException e) {
        // nothing found
    }
    return true;
}
 
Example 3
private boolean findAllDatabases() {
    databases = new ArrayList<>();

    File file = new File(FileUtils.getExternalDir());
    if (!FileUtils.makeSureDirectoryExists(file.getAbsolutePath())) {
        return false;
    }

    // add from "root"
    addAllDatabases(file, databases);

    // add from level below (Andriod usually unzips to a subdirectory)
    File[] subdirectories = file.listFiles(new FileFilter() {
        @Override
        public boolean accept(File path) {
            return path.isDirectory();
        }
    });
    try {
        for (File subdirectory : subdirectories) {
            addAllDatabases(subdirectory, databases);
        }
    } catch (NullPointerException e) {
        // nothing found
    }
    return true;
}