国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 網站 > 建站經驗 > 正文

Android安卓中循環錄像并-檢測內存卡容量

2019-11-02 15:17:03
字體:
來源:轉載
供稿:網友

 這篇文章主要介紹了Android安卓中循環錄像并檢測內存卡容量,當內存卡空間已滿時,本文還實現自動刪除視頻列表里面的第一個文件,需要的朋友可以參考下

    ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1
樂樂影院[www.aikan.tv/special/leleyingyuan/]
7 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 /** * 循環錄像,當內存卡容量少于300M時,自動刪除視頻列表里面的第一個文件 */ private void xunhuanluxiang() { if (Environment.getExternalStorageState().equals( Environment.MEDIA_MOUNTED)) { File path = Environment.getExternalStorageDirectory(); // 取得sdcard文件路徑 StatFs statfs = new StatFs(path.getPath()); // 獲取block的SIZE long blocSize = statfs.getBlockSize(); // 獲取BLOCK數量 long totalBlocks = statfs.getBlockCount(); // 己使用的Block的數量 long availaBlock = statfs.getAvailableBlocks(); // 獲取當前可用內存容量,單位:MB long sd = availaBlock * blocSize / 1024 / 1024; if (sd < 300) { String filepath = (Environment.getExternalStorageDirectory() .getAbsolutePath() + "/video/"); File file = new File(filepath); if (!file.exists()) { file.mkdirs(); } File[] files = file.listFiles(); if (files.length > 0) { String childFile[] = file.list(); String dele = (filepath + childFile[0]); File file2 = new File(dele); file2.delete(); } } } else if (Environment.getExternalStorageState().equals( Environment.MEDIA_REMOVED)) { Toast.makeText(this, "請插入內存卡", Toast.LENGTH_SHORT).show(); } }
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 重庆市| 交城县| 望城县| 松阳县| 成安县| 河北区| 都昌县| 江都市| 门源| 昆明市| 高尔夫| 揭阳市| 志丹县| 兴仁县| 安达市| SHOW| 昌平区| 平江县| 光泽县| 临西县| 涪陵区| 建德市| 静宁县| 新营市| 金阳县| 昆明市| 金门县| 万安县| 绍兴市| 淮北市| 南陵县| 和顺县| 宜兰县| 吉木萨尔县| 个旧市| 东阿县| 微山县| 嘉禾县| 永德县| 泸定县| 峨眉山市|