Android - 清空Temp資料夾

摘要:Android - 清空Temp資料夾


	private void clearTempFile() {
	    try {
            File tempDir = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), APP_TEMP_NAME);
            
            // Create the storage directory if it does not exist.
            if (albumDir.exists()){
                File[] files = tempDir.listFiles();
                for(File f:files) {
                    f.delete();
                }
            } 
	    }catch(Exception ex) {
	        ex.printStackTrace();
	    }
	}