『Android』 獲取檔案系統剩餘空間

winncyrus發表於2013-04-18

關鍵類:android.os.StatFs

獲取sdcard剩餘空間:

import android.os.StatFs;

            String storageDirectory = Environment
                    .getExternalStorageDirectory().toString();
            StatFs stat = new StatFs(storageDirectory);
            long remaining = (long) stat.getAvailableBlocks()
                    * (long) stat.getBlockSize();


相關文章