List of usage examples for android.os StatFs StatFs
public StatFs(String path)
From source file:Main.java
public static boolean isAvailableExternalMemory(File paramFile) { StatFs localStatFs = new StatFs(paramFile.getPath()); return (int) (localStatFs.getBlockSize() * localStatFs.getAvailableBlocks() / 1048576L) > 15; }
From source file:Main.java
public static float getLocalStorageSpace() { float space = 0; try {/* www . j av a2s .com*/ StatFs stat = new StatFs("/data/"); space = stat.getAvailableBlocks() * (float) stat.getBlockSize(); } catch (Exception e) { e.printStackTrace(); } return space; }
From source file:Main.java
private static boolean checkMicroSDCard(String fileSystemName) { StatFs statFs = new StatFs(fileSystemName); long totalSize = (long) statFs.getBlockSize() * statFs.getBlockCount(); if (totalSize < 1024 * 1024 * 1024 * 1024) { return false; }//from w ww . j av a 2 s.c o m return true; }
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 long freeSpaceOnSD() { StatFs stat = new StatFs(Environment.getExternalStorageDirectory().getPath()); return stat.getAvailableBlocksLong() * stat.getBlockSizeLong(); }
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
/** * @return Free size in SDcard//w w w. j ava2 s . 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; }
From source file:Main.java
public static long getExternalStorageSpace() { long space = 0; try {//from w w w .j a v a 2 s. c o m StatFs stat = new StatFs(Environment.getExternalStorageDirectory().getAbsolutePath()); space = (long) stat.getAvailableBlocks() * (long) stat.getBlockSize(); } catch (Exception e) { e.printStackTrace(); } return space; }