編輯:關於Android編程
/**
* 循環錄像,當內存卡容量少於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();
}
}
Android: 顯示系統模塊加載以及調用流程
打開/dev/graphics/fb0節點的過程:打開/dev/graphics/fb0這個設備的調用過程如下:1.在HWComposer中,加載moduleHWComp
Android開發必知 九種對話框的實現方法
在開發過程中,與用戶交互式免不了會用到對話框以實現更好的用戶體驗,所以掌握幾種對話框的實現方法還是非常有必要的。在看具體實例之前先對AlertDialog做一個簡單介紹。
Android網絡編程之獲取網絡上的XML
Android網絡編程之獲取網絡上的XML 請尊重他人的勞動成果,轉載請注明出處:Android網絡編程之獲取網絡上的XML 為要獲取網絡上的XML所以需要
Android中ViewPager的PagerTabStrip與PagerTitleStrip用法實例
零、概覽1.ViewPager說白了就是個控件,在使用時包名要帶全是Android.support.v4.view.ViewPager。由於我的ADT-Bundle版本比