Code example for File

Methods: list

0
    private String getActiveName(long currentTimeMillis) {
        String oldestActiveName = null;
        long oldestActiveStart = Long.MAX_VALUE;
 
        final FileInfo info = new FileInfo(mPrefix);
        for (String name : mBasePath.list()) {
            if (!info.parse(name)) continue;
 
            // pick the oldest active file which covers current time 
            if (info.isActive() && info.startMillis < currentTimeMillis
                    && info.startMillis < oldestActiveStart) {
                oldestActiveName = name;
                oldestActiveStart = info.startMillis;
            } 
        } 
 
        if (oldestActiveName != null) {
            return oldestActiveName;
        } else { 
            // no active file found above; create one starting now 
            info.startMillis = currentTimeMillis;