2011-02-24 78 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