如何检查的外部存储空间的可用性? [英] How to check availability of space on external storage?

查看:125
本文介绍了如何检查的外部存储空间的可用性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你如何检查SD卡已满或不那么你的应用程序可以决定是否可以继续做自己的工作,即写入外部存储或通知存储已经用尽空间的用户。

How do you check if the SD card is full or not so that your application can decide if it can continue to do its job i.e. write to external storage or notify the user that storage has run out of space.

推荐答案

使用体statfs ,并通过外部存储目录的路径构造,并且可以调用功能,为 getAvailableBlocks() getBlockSize()体statfs 对象。

Use StatFs and pass the path of the external storage directory to the constructor and you can call functions such as getAvailableBlocks() and getBlockSize() on the StatFs object.

这篇关于如何检查的外部存储空间的可用性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆