Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import android.support.v4.provider.DocumentFile;

public class Main {
    public static DocumentFile newDirectory(DocumentFile parentDir, String base) {
        int postfix = 0;
        do {
            String name = base;
            if (postfix > 0) {
                name += "_" + postfix;
            }
            if (parentDir.findFile(name) == null) {
                return parentDir.createDirectory(name);
            }
            postfix++;
        } while (true);
    }
}