1

写入文件时出现“设备上没有剩余空间”IOException。我希望避免它在写作之前发生。我应该怎么做?

谢谢!

4

1 回答 1

1

来自: 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;
于 2010-11-17T09:19:33.913 回答