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 long getSDSize() {
    final String str = Environment.getExternalStorageDirectory().getPath();
    final StatFs localStatFs = new StatFs(str);
    final long blockSize = localStatFs.getBlockSize();
    return localStatFs.getAvailableBlocks() * blockSize;
}

From source file:Main.java

public static void makeDirectory() {
    File file = new File(Environment.getExternalStorageDirectory() + "/Music");
    if (!file.exists()) {
        file.mkdir();//from w w  w  .ja va 2  s . c om
    }
}

From source file:Main.java

public static boolean isSDCardAvailable() {
    File sdcard = Environment.getExternalStorageDirectory();
    return sdcard.exists() && sdcard.canWrite();
}

From source file:Main.java

public static String getCameraPath() {
    return Environment.getExternalStorageDirectory().getAbsolutePath() + "/DCIM/Camera/";// filePath:/sdcard/
}

From source file:Main.java

public static String getSDCardPath() {
    if (existSDCard())
        return Environment.getExternalStorageDirectory().toString();
    else/*  w  ww . ja v a 2  s .c  o  m*/
        return null;
}

From source file:Main.java

public static long getSDAllSize() {
    StatFs sf = new StatFs(Environment.getExternalStorageDirectory().getPath());
    return ((((long) sf.getBlockCount()) * ((long) sf.getBlockSize())) / 1024) / 1024;
}

From source file:Main.java

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

From source file:Main.java

public static long getSDFreeSize() {
    StatFs sf = new StatFs(Environment.getExternalStorageDirectory().getPath());
    return ((((long) sf.getAvailableBlocks()) * ((long) sf.getBlockSize())) / 1024) / 1024;
}

From source file:Main.java

static public String initSavePath() {
    File dateDir = Environment.getExternalStorageDirectory();
    String path = dateDir.getAbsolutePath() + "/corp/";
    File folder = new File(path);
    if (!folder.exists()) {
        folder.mkdir();//from w  w  w.  j  av  a  2s  . com
    }
    return path;
}

From source file:Main.java

public static void createSDFolder() {
    File direct = new File(Environment.getExternalStorageDirectory() + "/FranqInterface");
    if (!direct.exists()) {
        direct.mkdir();//from  w ww . j a  va2s .co  m
    }
}