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;

public class Main {

    public static String getBaseSavePath(Context context) {
        String baseSavePath;

        if (isSDCardEnable()) {
            baseSavePath = getSDCardPath_M1();
        } else {
            baseSavePath = context.getFilesDir().getAbsolutePath();
        }

        return baseSavePath;
    }

    public static boolean isSDCardEnable() {
        return Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED);
    }

    public static String getSDCardPath_M1() {
        return Environment.getExternalStorageDirectory().getAbsolutePath();
    }
}