2011-02-24 49 views

回答

15
File file = new File("xxx.flv"); 

long length = file.length(); 

length = length/1024; 
+0

如果我試圖從http://獲取視頻文件,該怎麼辦?是否可以通過閱讀元數據來獲取大小? – Sen 2011-02-24 14:42:03

+3

你應該在問題中提及這樣的事情。閱讀[範圍請求](http://stackoverflow.com/questions/3411480/how-to-resume-an-interrupted-download/3411558#3411558)。或[this](http://stackoverflow.com/questions/3276249/getting-the-file-size-before-downloading-in-android/3276263#3276263) – Reno 2011-02-24 15:01:22