privatelonggetSDcardRemainSize(){判断存储卡是否存在StringstateEnvironment.getExternalStorageState() private long getSDcardRemainSize() { // 判断存储卡是否存在 String state Environment.getExternalStorageState(); if (state.eq
privatelonggetSDcardRemainSize(){判断存储卡是否存在StringstateEnvironment.getExternalStorageState() private long getSDcardRemainSize() { // 判断存储卡是否存在 String state Environment.getExternalStorageState(); if (state.equals(Environment.MEDIA_MOUNTED)) { // 取得SD卡文件路径 File path Environment.getExternalStorageDirectory(); // StatFs看文件系统空间的使用情况 StatFs statFs new StatFs(path.getPath()); // Block的size long blockSize statFs.getBlockSize(); // 总的Block数量 long availableBlock statFs.getAvailableBlocks(); long size availableBlock * blockSize; return size; } else { return 0; } }【文章原创作者:
阜宁网页制作公司 http://www.1234xp.com/funing.html 欢迎留下您的宝贵建议】