Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.os.Environment;
import android.text.TextUtils;
import java.io.File;

public class Main {

    public static String getStoragePath() {
        if (!isCardExist())
            return null;
        File path = Environment.getExternalStorageDirectory();
        if (path != null && !TextUtils.isEmpty(path.getAbsolutePath())) {
            return path.getAbsolutePath();
        } else {
            return null;
        }
    }

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