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.content.Context;

public class Main {
    private static String getExternalStoragePathByContext(String path, Context context) {
        File dirPath = context.getExternalFilesDir(path);
        if (dirPath == null) {
            dirPath = new File(context.getExternalFilesDir(null).getAbsolutePath() + "/" + path + "/");
        }

        if (!dirPath.exists()) {
            dirPath.mkdir();
        }
        return dirPath.getAbsolutePath();
    }
}