android获取外置SD卡可用空间大小
// 获取外置SD卡的可用空间大小 public static long getWaiZhiSDCardAvailableSize(String rootPath) { if (isSDCardMounted()) { StatFs fs = new StatFs(rootPath); long count = fs.getAvailableBlocksLong(); long size = fs.getBlockSizeLong(); return count * size / 1024 / 1024; } return 0; }
其中rootPath是外置sd卡的根目录,返回的是MB
Dana.Lee
To:Dana_Lee1016@126.com