zoukankan      html  css  js  c++  java
  • Android常用的

     1 /**
     2      * @return return true when the phone's SD card is available; Otherwise return false.
     3      */
     4     public static boolean hasSDCard() {
     5         return Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED);
     6     }
     7     
     8     /**
     9      * @return return true when the phone's SD card is available and has enough space; Otherwise return false.
    10      */
    11     public static boolean hasSpace() {
    12         if (!hasSDCard()) {
    13             return false;
    14         }
    15         File path = Environment.getExternalStorageDirectory();
    16         StatFs statFs = new StatFs(path.getPath());
    17         
    18         int blockSize = statFs.getBlockSize();
    19         long availableBlock = statFs.getAvailableBlocks();        
    20         long spareSize = blockSize * availableBlock;
    21 
    22         return spareSize >= Constants.SDCARD_MIN_SPARE_SIZE;
    23     }
  • 相关阅读:
    第一阶段站立会议4
    第一阶段站立会议3
    用户场景描述
    第一阶段站立会议2
    第一阶段站立会议1
    第七周进度条
    第十二周工作总结
    寻找水王
    第十一周工作总结
    构建之法阅读笔记05
  • 原文地址:https://www.cnblogs.com/oakpip/p/2013747.html
Copyright © 2011-2022 走看看