I'm doing a project which is similar to the Download Manager.
One of the functions is to allow the user to pause the file so they can resume the download later. I have Googled it, but unluckily still haven't solved the problem (maybe I'm new in android and stupid to solve it).
The question is... If one of the files hasn't finish the download, how do I get the current stream / size of the file? And how can I continue to write the file?
I have seen a code in java as below:
begin = downloaded;
file = (FileConnection) Connector.open("\sdcard\abc.mp3");
OutputStream output = file.openOutputStream(begin);
DataOutputStream dos = new DataOutputStream(output);
if(read != -1) {
dos.write(buffer, 0, read);
dos.flush();
downloaded += read;
}
But I don't really understand how it works in android :( Your reply is very appreciated!!!
P/S: I'm sorry about my bad English, hope you guys understand what I'm talking about. Thank you.
Regard