// Memory Card状态
String status = Environment.
getExternalStorageState
();
(1)获取sdcard的总存储空间;
long bCount = stat.getBlockCount();
long bSize = stat.getBlockSize();
long size = bytesToMB(bCount * bSize);
Log.d("human","count:"+stat.getBlockCount()+",size:"+stat.getBlockSize()+",T:"+size);
sTotalSpace = String.valueOf(size);
(2)获取sdcard的剩余存储空间;
long aBlocks = stat.getAvailableBlocks();
long bSize = stat.getBlockSize();
long size = bytesToMB(aBlocks * bSize);
Log.d("human","aBlocks:"+stat.getAvailableBlocks()+",size:"+stat.getBlockSize()+",A:"+size);
sAvaliableSize = String.valueOf(size);
(3)bytesToMB(Long);
private long bytesToMB(long nBytes){
return nBytes /1024 /1024;
}