List of utility methods to do SDCard Size Get
String | getSDPath() get SD Path String state = Environment.getExternalStorageState(); if (Environment.MEDIA_MOUNTED.equals(state)) { if (Environment.getExternalStorageDirectory().canWrite()) { return Environment.getExternalStorageDirectory().getPath(); return null; |
String[] | getMounts(CharSequence path) get Mounts BufferedReader bufferedReader = null; try { bufferedReader = new BufferedReader(new FileReader( "/proc/mounts"), 256); String line; while ((line = bufferedReader.readLine()) != null) { if (line.contains(path)) { return line.split(" "); ... |
String[] | getMounts(CharSequence path) get Mounts BufferedReader bufferedReader = null; try { bufferedReader = new BufferedReader(new FileReader( "/proc/mounts"), 256); String line; while ((line = bufferedReader.readLine()) != null) { if (line.contains(path)) { return line.split(" "); ... |
long | getAvailableMb(String path) get Available Mb final long SIZE_KB = 1024L; final long SIZE_MB = SIZE_KB * SIZE_KB; long availableSpace = -1L; StatFs stat = new StatFs(path); availableSpace = (long) stat.getAvailableBlocks() * (long) stat.getBlockSize(); return availableSpace / SIZE_MB; |
long | getUsableSpace(File path) get Usable Space try { final StatFs stats = new StatFs(path.getPath()); return (long) stats.getBlockSize() * (long) stats.getAvailableBlocks(); } catch (Exception e) { e.printStackTrace(); return -1; |
long | getUsableSpace(File path) get Usable Space final StatFs stats = new StatFs(path.getPath()); return (long) stats.getBlockSize() * (long) stats.getAvailableBlocks(); |