Hi,
My application needs to download a few files, each about 1-2 MB in
size. I host these files on my ftp server and use the simple code
below. Works great on my device and seemingly for most users but a few
report they get the message from the exception and others say that the
code never finishes and the download just hangs.
Is there a better way to download files?
byte[] buffer = new byte[10000];
int cc = 0;
try {
String url = "ftp://user:[email protected]:21/
mydirectory/" + in;
mInputStream = new URL(url).openStream();
mOutputStream = new
FileOutputStream(mAppDir.getAbsolutePath() + "/" + out);
do {
cc = mInputStream.read(buffer);
if (cc > 0)
mOutputStream.write(buffer, 0, cc);
} while (cc > 0);
}
catch (Exception ex) {
result = ERROR_NETWORK;
}
Thank you for any input...
Martin
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
To unsubscribe, reply using "remove me" as the subject.