Example usage for android.os Environment getExternalStorageDirectory

List of usage examples for android.os Environment getExternalStorageDirectory

Introduction

In this page you can find the example usage for android.os Environment getExternalStorageDirectory.

Prototype

public static File getExternalStorageDirectory() 

Source Link

Document

Return the primary shared/external storage directory.

Usage

From source file:Main.java

public static String getSDCardPath() {
    if (sdCardIsExit()) {
        return Environment.getExternalStorageDirectory().getAbsolutePath() + "/";
    }/*w  ww  .  j av a 2  s. c  o m*/
    return null;
}

From source file:Main.java

public static String getSDcardRoot() {
    if (isSDcardOK()) {
        return Environment.getExternalStorageDirectory().getAbsolutePath();
    }// ww  w. j  a  v  a 2 s  .co m

    return null;
}

From source file:Main.java

public static String getSDCardPath() {
    return checkSDCard() ? Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator
            : Environment.getDataDirectory().getAbsolutePath() + File.separator;
}

From source file:Main.java

public static long FreeMemory() {
    StatFs statFs = new StatFs(Environment.getExternalStorageDirectory().getAbsolutePath());
    long Free = (statFs.getAvailableBlocksLong() * statFs.getBlockSize()) / 1048576;
    return Free;/*from www.j av a  2 s  . com*/
}

From source file:Main.java

public static String getRootDir() {
    if (isHasSdcard()) {
        return Environment.getExternalStorageDirectory().getAbsolutePath() + "/YLTadm/";
    } else {/*from w  w  w.j  a  va  2s .  co m*/
        return Environment.getDataDirectory().getAbsolutePath() + "/";
    }
}

From source file:Main.java

public static String getRootPath() {
    if (checkSDCard()) {
        return Environment.getExternalStorageDirectory().getPath();
    }/*  w  w  w  .  j ava  2  s  .com*/
    return "";
}

From source file:Main.java

public static String getExternalDir() {
    return Environment.getExternalStorageDirectory().getAbsolutePath() + "/";
}

From source file:Main.java

private static File descriptorFromSdCard(String path) {
    File sdRoot = Environment.getExternalStorageDirectory();
    return new File(sdRoot, path);
}

From source file:Main.java

public static String getImageDir() {
    String fileDir = Environment.getExternalStorageDirectory() + "/fantasy/";

    File dirFile = new File(fileDir);
    if (!dirFile.exists()) {
        dirFile.mkdirs();//from  w  w  w  .  jav a 2 s .  c om
    }

    return fileDir;
}

From source file:Main.java

static public long getFreeSpaceOnSD() {
    StatFs stat = new StatFs(Environment.getExternalStorageDirectory().getPath());
    return stat.getAvailableBlocks() * stat.getBlockSize();
}