Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.content.Context;
import android.os.Environment;
import java.io.File;

public class Main {
    public static String getGlideDefaultPath(Context context) {
        if (context == null) {
            throw new RuntimeException("context can't be null");
        }
        String path = context.getCacheDir().getAbsolutePath();
        if (isSDCard()) {
            String directory = Environment.getExternalStorageDirectory() + "/GankLy/cache/img";
            File file = new File(directory);
            if (!file.exists()) {
                if (file.mkdirs()) {
                    return directory;
                }
            }
        }
        return path;
    }

    public static boolean isSDCard() {
        return android.os.Environment.getExternalStorageState().equals(android.os.Environment.MEDIA_MOUNTED);
    }
}