List of usage examples for android.os Environment getExternalStorageDirectory
public static File getExternalStorageDirectory()
From source file:Main.java
public static long freeSpaceOnSD() { StatFs stat = new StatFs(Environment.getExternalStorageDirectory().getPath()); return stat.getAvailableBlocksLong() * stat.getBlockSizeLong(); }
From source file:Main.java
public static File getStoragePath(Context ctx, String directory) { return new File(Environment.getExternalStorageDirectory(), ctx.getPackageName() + "/" + directory); }
From source file:Main.java
private static int freeSpaceOnSd() { StatFs stat = new StatFs(Environment.getExternalStorageDirectory().getPath()); @SuppressWarnings("deprecation") double sdFreeMB = ((double) stat.getAvailableBlocks() * (double) stat.getBlockSize()) / MB; return (int) sdFreeMB; }
From source file:Main.java
public static int freeSpaceOnSd() { StatFs stat = new StatFs(Environment.getExternalStorageDirectory().getPath()); double sdFreeMB = ((double) stat.getAvailableBlocks() * (double) stat.getBlockSize()) / MB; return (int) sdFreeMB; }
From source file:Main.java
public static int freeSpaceOnSDMB() { StatFs stat = new StatFs(Environment.getExternalStorageDirectory().getPath()); double sdFreeMB = ((double) stat.getAvailableBlocksLong() * (double) stat.getBlockSizeLong()) / 1024 * 1024; return (int) sdFreeMB; }
From source file:Main.java
public static File getAndroidDataFile(String packageName) { String internalsd = Environment.getExternalStorageDirectory().getAbsolutePath(); //getInternalSdcardPath(); return (TextUtils.isEmpty(internalsd) || TextUtils.isEmpty(packageName)) ? null : new File(internalsd, "Android/data/" + packageName); }
From source file:Main.java
public static String getInternalStorage() { if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())) return Environment.getExternalStorageDirectory().getAbsolutePath(); return ""; }
From source file:Main.java
public static String getSDCardDir() { if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) { return Environment.getExternalStorageDirectory().getPath(); }//from ww w . j ava 2 s . c o m return null; }
From source file:Main.java
public static File getPicturePath() { File path = new File(Environment.getExternalStorageDirectory(), PATH_IMG); if (!path.exists()) { path.mkdirs();//from w w w . ja va 2 s . com } return path; }
From source file:Main.java
/** * @return Free size in SDcard// w w w.java 2s. c o m */ private static int sdFreeSize() { StatFs stat = new StatFs(Environment.getExternalStorageDirectory().getPath()); long bytesAvailable = (long) stat.getBlockSize() * (long) stat.getAvailableBlocks(); int sdFreeMegs = (int) (bytesAvailable / (1024 * 1024)); return sdFreeMegs; }