Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.io.File;

import android.os.Environment;

public class Main {
    static String mPrivatePath = "/cartman_mm/";
    static String mPublicPath = "/kyle_mm/";

    private static void createFolderUnderPrivate(String folderName) {
        String folderPathString = getSDPath() + mPrivatePath;
        checkSDPrivateFolder();
        String newFolder = folderPathString + folderName + "/";
        File path = new File(newFolder);
        if (!path.exists()) {
            path.mkdir();
        }
    }

    private static String getSDPath() {
        return Environment.getExternalStorageDirectory().getPath();
    }

    public static void checkSDPrivateFolder() {
        String folderPathString = getSDPath() + mPrivatePath;
        File path = new File(folderPathString);
        if (!path.exists()) {
            path.mkdir();
        }

        String folderPathString2 = getDataPublicPath();
        path = new File(folderPathString2);
        if (!path.exists()) {
            path.mkdir();
        }
    }

    public static String getDataPublicPath() {
        return getSDPath() + mPublicPath;
    }
}