写入文件时出现“设备上没有剩余空间”IOException。我希望避免它在写作之前发生。我应该怎么做?
谢谢!
来自: http ://groups.google.com/group/android-developers/browse_thread/thread/ecede996463a4058
StatFs stat = new StatFs(Environment.getExternalStorageDirectory().getPath());
long bytesAvailable = (long)stat.getBlockSize() * (long)stat.getBlockCount();
long megAvailable = bytesAvailable / 1048576;