Code example for StatFs

Methods: getBlockCount, getBlockSize

0
	 * 返回内部存储器总大小 
	 */ 
	public long getTotalInternalStorageSize() 
	{ 
		File path = Environment.getDataDirectory();
		StatFs stat = new StatFs(path.getPath());
		long blockSize = stat.getBlockSize();
		long totalBlocks = stat.getBlockCount();
		return totalBlocks * blockSize;
	} 
	 
	/** 
	 * 返回外部存储器可用大小 
	 * @return 
	 */ 
	public long getAvailableExternalStorageSize()  
	{ 
		String __state = Environment.getExternalStorageState();
		if (Environment.MEDIA_MOUNTED.equals(__state)) 
		{ 
			File __sdcardDir = Environment.getExternalStorageDirectory();