public static long getTotalSize(String device) {
StatFs sf = new StatFs (device);
//long totalblocks = sf.getBlockCountLong();
//long freeblocks = sf.getFreeBlocksLong();//为使用的,包括 系统保留的部分
long avablocks = sf.getAvailableBlocksLong();//可用的,不包括 系统保留的部分
long bsize = sf.getBlockSizeLong();
//long usedsize = totalblocks - freeblocks;
Log.e(TAG, "totalblocks = " + totalblocks);
Log.e(TAG, "totalblocksize = " + totalblocks*bsize/1024/1024);
Log.e(TAG, "freeblocks = " + freeblocks);
Log.e(TAG, "freeblocksize = " + freeblocks*bsize/1024/1024);
Log.e(TAG, "avablocks = " + avablocks);
Log.e(TAG, "avablocksize = " + avablocks*bsize/1024/1024);
Log.e(TAG, "usedsize = " + usedsize*bsize/1024/1024);
return 0;
}关于 查看文件的size,布布扣,bubuko.com
关于 查看文件的size
原文:http://blog.csdn.net/jiaoheshang/article/details/25124275