1

Is it possible to get the size of the video in kilobytes in android? Is there any API for that?

Update I am trying to fetch the video from a http:// location.

Navaneeth Sen
  • 6,315
  • 11
  • 53
  • 82

1 Answers1

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

long length = file.length();

length = length/1024;
Reno
  • 33,594
  • 11
  • 89
  • 102
  • What if i am trying to get a video file from the http://. Is it possible to get the size by reading the metadata? – Navaneeth Sen Feb 24 '11 at 14:42
  • 3
    You ought to mention such things in the question. Read about [range requests](http://stackoverflow.com/questions/3411480/how-to-resume-an-interrupted-download/3411558#3411558). or [this](http://stackoverflow.com/questions/3276249/getting-the-file-size-before-downloading-in-android/3276263#3276263) – Reno Feb 24 '11 at 15:01