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 String getAppPath() {
        String dir = getSDcardDir() + "leanchat/";
        return checkAndMkdirs(dir);
    }

    public static String getSDcardDir() {
        return Environment.getExternalStorageDirectory().getPath() + "/";
    }

    public static String checkAndMkdirs(String dir) {
        File file = new File(dir);
        if (file.exists() == false) {
            file.mkdirs();
        }
        return dir;
    }
}