GeeCON Prague 2014*
The moose likes Android and the fly likes Downloading a 3gp video file from Internet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Mobile » Android
Bookmark "Downloading a 3gp video file from Internet" Watch "Downloading a 3gp video file from Internet" New topic
Author

Downloading a 3gp video file from Internet

Monica Marcus
Ranch Hand

Joined: Oct 17, 2012
Posts: 43
I want to download a video file (extension 3gp) from a certain http address. My application starts downloading, but it stops after downloading 9216 bytes. The file length is 1734741. I tried to increase the heap by including the following line in the Manifest file:

android:largeHeap="true"

It does not help. Here is the fragment of the java code that deals with downloading:



The application uses a Progress Bar to show the progress of the download. Because the file length is quite big, I did logarithmic calculations. Also, I have several Log.v messages to see what's going on, I hope this does not hamper understanding of the code.
Anyway, my question refers only to the incomplete downloading of the 3gp file.

What can I do to download the video file? Thanks for the help I got so far with my previous questions!
It is a great forum!

Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42042
    
  64
How big is "quite big"?


Ping & DNS - my free Android networking tools app
Monica Marcus
Ranch Hand

Joined: Oct 17, 2012
Posts: 43
The file length is 1734741 bytes.
Monica Marcus
Ranch Hand

Joined: Oct 17, 2012
Posts: 43
I re-wrote the code so that it does only the downloading. Maybe this way one can give me an idea about what's wrong with it. I really need help. Can't get it to download the file



And strangely enough, sometimes the method connection.getContentLength() returns -1

Monica Marcus
Ranch Hand

Joined: Oct 17, 2012
Posts: 43
Well, I found the opportunity to try the code on a real device and it works. The emulator is not that reliable... this is my conclusion.
 
GeeCON Prague 2014
 
subject: Downloading a 3gp video file from Internet