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     }
  • 相关阅读:
    读操作
    读锁与写锁
    Mvcc
    readView
    版本链
    事务的隔离性
    索引的代价
    keras backend的修改
    caffe 笔记
    菜品识别 SDK调用
  • 原文地址:https://www.cnblogs.com/oakpip/p/2013747.html
Copyright © 2011-2022 走看看