Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import android.os.Environment;

import java.io.File;

public class Main {
    public static File getDiskDir(String uniqueName) {
        if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())
                || !Environment.isExternalStorageRemovable()) {
            File storageDirectory = Environment.getExternalStorageDirectory();
            if (storageDirectory != null) {
                File file = new File(storageDirectory + File.separator + uniqueName);
                if (!file.exists() && !file.isDirectory()) {
                    file.mkdir();
                }
                return file;
            }
        }
        return null;
    }
}