获得内存大小
获得可用内存大小:
API18(Android4.3)以后getBlockSize过时并且改为了getBlockSizeLong ,所以18之前不要long
File path = Environment.getExternalStorageDirectory(); StatFs statFs = new StatFs(path.getPath()); long blocksize = statFs.getBlockSizeLong(); long availablesize = statFs.getAvailableBlocksLong(); Resize = blocksize * availablesize;//单位byte , 可以自行转化为M、GB, long类型